summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/JumpThreading/basic.ll
diff options
context:
space:
mode:
authorHaicheng Wu <haicheng@codeaurora.org>2016-03-16 04:52:52 +0000
committerHaicheng Wu <haicheng@codeaurora.org>2016-03-16 04:52:52 +0000
commit7873857a8893c17335de7693fea860bdc4b162f0 (patch)
tree16a1d1889d9690f2493c3af1fc482ef614eb3426 /llvm/test/Transforms/JumpThreading/basic.ll
parentc9daaaedb67e1e0265f795f8a9cbad6bc9553883 (diff)
downloadbcm5719-llvm-7873857a8893c17335de7693fea860bdc4b162f0.tar.gz
bcm5719-llvm-7873857a8893c17335de7693fea860bdc4b162f0.zip
[JumpThreading] See through Cast Instructions
To capture more jump-thread opportunity. llvm-svn: 263618
Diffstat (limited to 'llvm/test/Transforms/JumpThreading/basic.ll')
-rw-r--r--llvm/test/Transforms/JumpThreading/basic.ll34
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/test/Transforms/JumpThreading/basic.ll b/llvm/test/Transforms/JumpThreading/basic.ll
index 46c92bc1f57..14cd1fbe1c8 100644
--- a/llvm/test/Transforms/JumpThreading/basic.ll
+++ b/llvm/test/Transforms/JumpThreading/basic.ll
@@ -476,6 +476,40 @@ exit1:
; CHECK: }
}
+;;; Verify that we can handle constraint propagation through cast.
+define i32 @test16(i1 %cond) {
+Entry:
+; CHECK-LABEL: @test16(
+ br i1 %cond, label %Merge, label %F1
+
+; CHECK: Entry:
+; CHECK-NEXT: br i1 %cond, label %F2, label %Merge
+
+F1:
+ %v1 = call i32 @f1()
+ br label %Merge
+
+Merge:
+ %B = phi i32 [0, %Entry], [%v1, %F1]
+ %M = icmp eq i32 %B, 0
+ %M1 = zext i1 %M to i32
+ %N = icmp eq i32 %M1, 0
+ br i1 %N, label %T2, label %F2
+
+; CHECK: Merge:
+; CHECK-NOT: phi
+; CHECK-NEXT: %v1 = call i32 @f1()
+
+T2:
+ %Q = call i32 @f2()
+ ret i32 %Q
+
+F2:
+ ret i32 %B
+; CHECK: F2:
+; CHECK-NEXT: phi i32
+}
+
; In this test we check that block duplication is inhibited by the presence
; of a function with the 'noduplicate' attribute.
OpenPOWER on IntegriCloud