diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-10 01:57:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-10 01:57:31 +0000 |
commit | fddcf47a249fe3a1102257deddc996ee327a85cb (patch) | |
tree | 9e81c9895575bf6cb199c767730b9b391e46a44f /test/Transforms/JumpThreading/basic.ll | |
parent | 9f3ce36d7e58ec76442a2545782c69fcbac2a757 (diff) | |
download | external_llvm-fddcf47a249fe3a1102257deddc996ee327a85cb.zip external_llvm-fddcf47a249fe3a1102257deddc996ee327a85cb.tar.gz external_llvm-fddcf47a249fe3a1102257deddc996ee327a85cb.tar.bz2 |
make jump threading recursively simplify expressions instead of doing it
just one level deep. On the testcase we go from getting this:
F1: ; preds = %T2
%F = and i1 true, %cond ; <i1> [#uses=1]
br i1 %F, label %X, label %Y
to a fully threaded:
F1: ; preds = %T2
br label %Y
This changes gets us to the point where we're forming (too many) switch
instructions on doug's strswitch testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86646 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 7b444ad..1be086b 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -203,3 +203,35 @@ F2: ; CHECK-NEXT: phi i32 } + +declare i1 @test8a() + +define i32 @test8b(i1 %cond, i1 %cond2) { +; CHECK: @test8b +T0: + %A = call i1 @test8a() + br i1 %A, label %T1, label %F1 +T1: + %B = call i1 @test8a() + br i1 %B, label %T2, label %F1 +T2: + %C = call i1 @test8a() + br i1 %cond, label %T3, label %F1 +T3: + ret i32 0 + +F1: +; TODO: F1 uncond branch block should be removed, T2 should jump directly to Y. +; CHECK: F1: +; CHECK-NEXT br label %Y + %D = phi i32 [0, %T0], [0, %T1], [1, %T2] + %E = icmp eq i32 %D, 1 + %F = and i1 %E, %cond + br i1 %F, label %X, label %Y +X: + call i1 @test8a() + ret i32 1 +Y: + ret i32 2 +} + |