[llvm-commits] [llvm] r123219 - in /llvm/trunk: lib/Transforms/Scalar/LoopRotation.cpp test/Transforms/LoopRotate/crash.ll
Chris Lattner
sabre at nondot.org
Mon Jan 10 23:47:59 PST 2011
Author: lattner
Date: Tue Jan 11 01:47:59 2011
New Revision: 123219
URL: http://llvm.org/viewvc/llvm-project?rev=123219&view=rev
Log:
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).
Added:
llvm/trunk/test/Transforms/LoopRotate/crash.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp?rev=123219&r1=123218&r2=123219&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Tue Jan 11 01:47:59 2011
@@ -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;
Added: llvm/trunk/test/Transforms/LoopRotate/crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopRotate/crash.ll?rev=123219&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopRotate/crash.ll (added)
+++ llvm/trunk/test/Transforms/LoopRotate/crash.ll Tue Jan 11 01:47:59 2011
@@ -0,0 +1,31 @@
+; RUN: opt -loop-rotate %s -disable-output
+
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
+target triple = "x86_64-apple-darwin10.0.0"
+
+; PR8955 - Rotating an outer loop that has a condbr for a latch block.
+define void @test1() nounwind ssp {
+entry:
+ br label %lbl_283
+
+lbl_283: ; preds = %if.end, %entry
+ br i1 undef, label %if.else, label %if.then
+
+if.then: ; preds = %lbl_283
+ br i1 undef, label %if.end, label %for.condthread-pre-split
+
+for.condthread-pre-split: ; preds = %if.then
+ br label %for.cond
+
+for.cond: ; preds = %for.cond, %for.condthread-pre-split
+ br i1 undef, label %lbl_281, label %for.cond
+
+lbl_281: ; preds = %if.end, %for.cond
+ br label %if.end
+
+if.end: ; preds = %lbl_281, %if.then
+ br i1 undef, label %lbl_283, label %lbl_281
+
+if.else: ; preds = %lbl_283
+ ret void
+}
More information about the llvm-commits
mailing list