[llvm-commits] [llvm] r57025 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll
Devang Patel
dpatel at apple.com
Fri Oct 3 11:57:38 PDT 2008
Author: dpatel
Date: Fri Oct 3 13:57:37 2008
New Revision: 57025
URL: http://llvm.org/viewvc/llvm-project?rev=57025&view=rev
Log:
Nick Lewycky's patch.
While hosting instruction check PHI node.
Added:
llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=57025&r1=57024&r2=57025&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Oct 3 13:57:37 2008
@@ -1051,7 +1051,7 @@
BasicBlock::iterator InsertPos = BI;
if (InsertPos != BIParent->begin())
--InsertPos;
- if (InsertPos == BrCond) {
+ if (InsertPos == BrCond && !isa<PHINode>(BrCond)) {
SmallPtrSet<Instruction *, 4> BB1Insns;
for(BasicBlock::iterator BB1I = BB1->begin(), BB1E = BB1->end();
BB1I != BB1E; ++BB1I)
Added: llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll?rev=57025&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll (added)
+++ llvm/trunk/test/Transforms/SimplifyCFG/2008-10-03-SpeculativelyExecuteBeforePHI.ll Fri Oct 3 13:57:37 2008
@@ -0,0 +1,36 @@
+; RUN: llvm-as < %s | opt -simplifycfg
+; PR2855
+
+define i32 @_Z1fPii(i32* %b, i32 %f) nounwind {
+entry:
+ br label %bb
+
+bb: ; preds = %bb9, %bb7, %bb, %entry
+ %__c2.2 = phi i32 [ undef, %entry ], [ %__c2.1, %bb7 ], [ %__c2.1, %bb9 ] ; <i32> [#uses=2]
+ %s.0 = phi i32 [ 0, %entry ], [ 0, %bb7 ], [ %2, %bb9 ] ; <i32> [#uses=1]
+ br label %bb1
+
+bb1: ; preds = %bb
+ %0 = icmp slt i32 0, %f ; <i1> [#uses=1]
+ br i1 %0, label %bb3, label %bb6
+
+bb3: ; preds = %bb1
+ %1 = icmp eq i32 0, 0 ; <i1> [#uses=1]
+ br i1 %1, label %bb6, label %bb5
+
+bb5: ; preds = %bb3
+ br label %bb7
+
+bb6: ; preds = %bb3, %bb1
+ %__c2.0 = phi i32 [ 0, %bb3 ], [ %__c2.2, %bb1 ] ; <i32> [#uses=1]
+ br label %bb7
+
+bb7: ; preds = %bb6, %bb5
+ %__c2.1 = phi i32 [ 0, %bb5 ], [ %__c2.0, %bb6 ] ; <i32> [#uses=2]
+ %iftmp.1.0 = phi i1 [ false, %bb5 ], [ true, %bb6 ] ; <i1> [#uses=1]
+ br i1 %iftmp.1.0, label %bb, label %bb9
+
+bb9: ; preds = %bb7
+ %2 = add i32 %s.0, 2 ; <i32> [#uses=1]
+ br label %bb
+}
More information about the llvm-commits
mailing list