summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2013-05-18 18:38:34 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2013-05-18 18:38:34 +0000
commit688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8 (patch)
tree47e826e7f6429f59bfe43a2a4b6d6ee0e04ae7ff /test/Transforms
parentedc399acebc94cfa26b47a6d8d836e2e1a009420 (diff)
downloadllvm-688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8.tar.gz
llvm-688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8.tar.bz2
llvm-688b5103eb4b70410d1ea54bcd8df4ef2f2ff8e8.tar.xz
LoopVectorize: Handle single edge PHIs
We might encouter single edge PHIs - handle them with an identity select. Fixes PR15990. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/LoopVectorize/if-conv-crash.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/LoopVectorize/if-conv-crash.ll b/test/Transforms/LoopVectorize/if-conv-crash.ll
index 3283456aa3..f8f2cf1fff 100644
--- a/test/Transforms/LoopVectorize/if-conv-crash.ll
+++ b/test/Transforms/LoopVectorize/if-conv-crash.ll
@@ -37,3 +37,25 @@ if.end21: ; preds = %lor.lhs.false
if.end25: ; preds = %entry
ret void
}
+
+; PR15990
+; We can have basic blocks with single entry PHI nodes.
+define void @single_entry_phi(i32* %a, i32 *%b) {
+entry:
+ br label %for.cond1.preheader
+
+for.cond1.preheader:
+ %inc10 = phi i32 [ 0, %entry ], [ %inc, %for.end ]
+ br label %for.end
+
+for.end:
+ %malicious.phi = phi i32 [ 0, %for.cond1.preheader ]
+ %inc = add nsw i32 %inc10, 1
+ %tobool = icmp eq i32 %inc, 0
+ br i1 %tobool, label %for.cond.for.end5, label %for.cond1.preheader
+
+for.cond.for.end5:
+ %and.lcssa = phi i32 [ %malicious.phi, %for.end ]
+ store i32 %and.lcssa, i32* %a, align 4
+ ret void
+}