summaryrefslogtreecommitdiff
path: root/test/Transforms/GVN
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-04 02:12:12 +0000
committerChris Lattner <sabre@nondot.org>2009-12-04 02:12:12 +0000
commite4968a4b9ddff2f5c44727017521d06842abe7fe (patch)
treed06ca28b9c00d0cc086b9212611f63f47d6373a2 /test/Transforms/GVN
parent210e45af3a579beeefb001c8f13c94e80407aad5 (diff)
downloadllvm-e4968a4b9ddff2f5c44727017521d06842abe7fe.tar.gz
llvm-e4968a4b9ddff2f5c44727017521d06842abe7fe.tar.bz2
llvm-e4968a4b9ddff2f5c44727017521d06842abe7fe.tar.xz
Small and carefully crafted testcase showing a miscompilation by GVN
that I'm working on. This is manifesting as a miscompile of 255.vortex on some targets. No check lines yet because it fails. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/GVN')
-rw-r--r--test/Transforms/GVN/rle.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll
index cdd1f4fa4e..ef34a36092 100644
--- a/test/Transforms/GVN/rle.ll
+++ b/test/Transforms/GVN/rle.ll
@@ -280,3 +280,36 @@ Cont:
}
+declare i1 @cond() readonly
+declare i1 @cond2() readonly
+
+define i32 @phi_trans2() {
+entry:
+ %P = alloca i32, i32 400
+ br label %F1
+
+F1:
+ %A = phi i32 [1, %entry], [2, %F]
+ %cond2 = call i1 @cond()
+ br i1 %cond2, label %T1, label %TY
+
+T1:
+ %P2 = getelementptr i32* %P, i32 %A
+ %x = load i32* %P2
+ %cond = call i1 @cond2()
+ br i1 %cond, label %TX, label %F
+
+F:
+ %P3 = getelementptr i32* %P, i32 2
+ store i32 17, i32* %P3
+
+ store i32 42, i32* %P2 ; Provides "P[A]".
+ br label %F1
+
+TX:
+ ret i32 %x ;; SHOULD NOT BE COMPILED TO 'ret i32 42'.
+TY:
+ ret i32 0
+}
+
+