remove a bogus assertion: the latch block of a loop is not
neccesarily an uncond branch to the header. This fixes
PR8955 (the assertion tripping).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123219 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp
index d1c975f..3bc4b1d 100644
--- a/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/lib/Transforms/Scalar/LoopRotation.cpp
@@ -335,12 +335,11 @@
assert(L->getLoopPreheader() && "Invalid loop preheader after loop rotation");
assert(L->getLoopLatch() && "Invalid loop latch after loop rotation");
- // Now that the CFG and DomTree are in a consistent state again, merge the
- // OrigHeader block into OrigLatch. We know that they are joined by an
- // unconditional branch. This is just a cleanup so the emitted code isn't
- // too gross.
- bool DidIt = MergeBlockIntoPredecessor(OrigHeader, this);
- assert(DidIt && "Block merge failed??"); (void)DidIt;
+ // Now that the CFG and DomTree are in a consistent state again, try to merge
+ // the OrigHeader block into OrigLatch. This will succeed if they are
+ // connected by an unconditional branch. This is just a cleanup so the
+ // emitted code isn't too gross in this common case.
+ MergeBlockIntoPredecessor(OrigHeader, this);
++NumRotated;
return true;