aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-06 21:52:06 +0000
committerChris Lattner <sabre@nondot.org>2007-11-06 21:52:06 +0000
commit27b695dde01fd64edd0a863db88dc0d2b403104d (patch)
tree631440d07c0f969f7105ccc71c8cece379678eef /test/Transforms
parent945923c3f11ee4ad9f261a9bca0c0a104d6804f8 (diff)
downloadexternal_llvm-27b695dde01fd64edd0a863db88dc0d2b403104d.zip
external_llvm-27b695dde01fd64edd0a863db88dc0d2b403104d.tar.gz
external_llvm-27b695dde01fd64edd0a863db88dc0d2b403104d.tar.bz2
Implement PR1777 by detecting dependent phis that
all compute the same value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/phi-merge.ll31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/phi-merge.ll b/test/Transforms/InstCombine/phi-merge.ll
new file mode 100644
index 0000000..daac412
--- /dev/null
+++ b/test/Transforms/InstCombine/phi-merge.ll
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {phi i32}
+; PR1777
+
+declare i1 @rrr()
+
+define i1 @zxcv() {
+entry:
+%a = alloca i32
+%i = ptrtoint i32* %a to i32
+%b = call i1 @rrr()
+br i1 %b, label %one, label %two
+
+one:
+%x = phi i32 [%i, %entry], [%y, %two]
+%c = call i1 @rrr()
+br i1 %c, label %two, label %end
+
+two:
+%y = phi i32 [%i, %entry], [%x, %one]
+%d = call i1 @rrr()
+br i1 %d, label %one, label %end
+
+end:
+%f = phi i32 [ %x, %one], [%y, %two]
+; Change the %f to %i, and the optimizer suddenly becomes a lot smarter
+; even though %f must equal %i at this point
+%g = inttoptr i32 %f to i32*
+store i32 10, i32* %g
+%z = call i1 @rrr()
+ret i1 %z
+}