diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-11 07:24:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-11 07:24:57 +0000 |
commit | 78c552ef309eb8c47d12aac2c0b3af7849c27ce9 (patch) | |
tree | 758d580bab499e7e9f5694fc245560749e73a82b /test/Transforms/JumpThreading/basic.ll | |
parent | 113e4c6070e2421b909bc369da3074508650de47 (diff) | |
download | external_llvm-78c552ef309eb8c47d12aac2c0b3af7849c27ce9.zip external_llvm-78c552ef309eb8c47d12aac2c0b3af7849c27ce9.tar.gz external_llvm-78c552ef309eb8c47d12aac2c0b3af7849c27ce9.tar.bz2 |
implement a transformation in jump threading that is currently
done by condprop, but do it in a much more general form. The
basic idea is that we can do a limited form of tail duplication
in the case when we have a branch on a phi. Moving the branch
up in to the predecessor block makes instruction selection
much easier and encourages chained jump threadings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/JumpThreading/basic.ll')
-rw-r--r-- | test/Transforms/JumpThreading/basic.ll | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index cab7712..50433db 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -105,3 +105,37 @@ F2: ret i32 %B } + +;; This tests that the branch in 'merge' can be cloned up into T1. +define i32 @test5(i1 %cond, i1 %cond2) { +; CHECK: @test5 + + br i1 %cond, label %T1, label %F1 + +T1: +; CHECK: T1: +; CHECK-NEXT: %v1 = call i32 @f1() +; CHECK-NEXT: %cond3 = icmp eq i32 %v1, 412 +; CHECK-NEXT: br i1 %cond3, label %T2, label %F2 + + %v1 = call i32 @f1() + %cond3 = icmp eq i32 %v1, 412 + br label %Merge + +F1: + %v2 = call i32 @f2() + br label %Merge + +Merge: + %A = phi i1 [%cond3, %T1], [%cond2, %F1] + %B = phi i32 [%v1, %T1], [%v2, %F1] + br i1 %A, label %T2, label %F2 + +T2: + call void @f3() + ret i32 %B + +F2: + ret i32 %B +} + |