diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-12 05:24:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-12 05:24:05 +0000 |
commit | 66c04c48debfd4357beaf9310346b2b24046b685 (patch) | |
tree | 21ae6fe818b545a074550b4d53b7bc1e221bf3ac /test/Transforms/JumpThreading/basic.ll | |
parent | f496e79f44f13ac80564f5f8e69aa648033e7889 (diff) | |
download | external_llvm-66c04c48debfd4357beaf9310346b2b24046b685.zip external_llvm-66c04c48debfd4357beaf9310346b2b24046b685.tar.gz external_llvm-66c04c48debfd4357beaf9310346b2b24046b685.tar.bz2 |
use getPredicateOnEdge to fold comparisons through PHI nodes,
which implements GCC PR18046. This also gets us 360 more
jump threads on 176.gcc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/JumpThreading/basic.ll')
-rw-r--r-- | test/Transforms/JumpThreading/basic.ll | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index 03ce12e..07b3b0c 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -349,6 +349,38 @@ BB4: ret i32 4 } +;; Correlated value through boolean expression. GCC PR18046. +define void @test12(i32 %A) { +; CHECK: @test12 +entry: + %cond = icmp eq i32 %A, 0 + br i1 %cond, label %bb, label %bb1 +; Should branch to the return block instead of through BB1. +; CHECK: entry: +; CHECK-NEXT: %cond = icmp eq i32 %A, 0 +; CHECK-NEXT: br i1 %cond, label %bb1, label %return + +bb: + %B = call i32 @test10f2() + br label %bb1 + +bb1: + %C = phi i32 [ %A, %entry ], [ %B, %bb ] + %cond4 = icmp eq i32 %C, 0 + br i1 %cond4, label %bb2, label %return + +; CHECK: bb1: +; CHECK-NEXT: %B = call i32 @test10f2() +; CHECK-NEXT: %cond4 = icmp eq i32 %B, 0 +; CHECK-NEXT: br i1 %cond4, label %bb2, label %return + +bb2: + %D = call i32 @test10f2() + ret void + +return: + ret void +} ;;; Duplicate condition to avoid xor of cond. |