[llvm-commits] [llvm] r71536 - in /llvm/trunk: lib/CodeGen/CodePlacementOpt.cpp test/CodeGen/ARM/2009-05-11-CodePlacementCrash.ll
Bob Wilson
bob.wilson at apple.com
Mon May 11 20:48:11 PDT 2009
Author: bwilson
Date: Mon May 11 22:48:10 2009
New Revision: 71536
URL: http://llvm.org/viewvc/llvm-project?rev=71536&view=rev
Log:
Fix pr4195: When iterating through predecessor blocks, break out of the loop
after finding the (unique) layout predecessor. Sometimes a block may be listed
more than once, and processing it more than once in this loop can lead to
inconsistent values for FtTBB/FtFBB, since the AnalyzeBranch method does not
clear these values. There's no point in continuing the loop regardless.
The testcase for this is reduced from the 2003-05-02-DependentPHI SingleSource
test.
Added:
llvm/trunk/test/CodeGen/ARM/2009-05-11-CodePlacementCrash.ll
Modified:
llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp
Modified: llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp?rev=71536&r1=71535&r2=71536&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodePlacementOpt.cpp Mon May 11 22:48:10 2009
@@ -155,10 +155,10 @@
// A fallthrough.
FtMBB = PredMBB;
MachineLoop *PL = MLI->getLoopFor(PredMBB);
- if (PL && (PL == L || PL->getLoopDepth() >= L->getLoopDepth())) {
+ if (PL && (PL == L || PL->getLoopDepth() >= L->getLoopDepth()))
OkToMove = false;
- break;
- }
+
+ break;
}
}
Added: llvm/trunk/test/CodeGen/ARM/2009-05-11-CodePlacementCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2009-05-11-CodePlacementCrash.ll?rev=71536&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2009-05-11-CodePlacementCrash.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/2009-05-11-CodePlacementCrash.ll Mon May 11 22:48:10 2009
@@ -0,0 +1,30 @@
+; RUN: llvm-as < %s | llc -march=arm
+ %struct.List = type { %struct.List*, i32 }
+ at Node5 = external constant %struct.List ; <%struct.List*> [#uses=1]
+@"\01LC" = external constant [7 x i8] ; <[7 x i8]*> [#uses=1]
+
+define i32 @main() nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb3, %entry
+ %CurL.02 = phi %struct.List* [ @Node5, %entry ], [ %2, %bb3 ] ; <%struct.List*> [#uses=1]
+ %PrevL.01 = phi %struct.List* [ null, %entry ], [ %CurL.02, %bb3 ] ; <%struct.List*> [#uses=1]
+ %0 = icmp eq %struct.List* %PrevL.01, null ; <i1> [#uses=1]
+ br i1 %0, label %bb3, label %bb1
+
+bb1: ; preds = %bb
+ br label %bb3
+
+bb3: ; preds = %bb1, %bb
+ %iftmp.0.0 = phi i32 [ 0, %bb1 ], [ -1, %bb ] ; <i32> [#uses=1]
+ %1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr ([7 x i8]* @"\01LC", i32 0, i32 0), i32 0, i32 %iftmp.0.0) nounwind ; <i32> [#uses=0]
+ %2 = load %struct.List** null, align 4 ; <%struct.List*> [#uses=2]
+ %phitmp = icmp eq %struct.List* %2, null ; <i1> [#uses=1]
+ br i1 %phitmp, label %bb5, label %bb
+
+bb5: ; preds = %bb3
+ ret i32 0
+}
+
+declare i32 @printf(i8* nocapture, ...) nounwind
More information about the llvm-commits
mailing list