summaryrefslogtreecommitdiff
path: root/test/Transforms/JumpThreading
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-08-31 17:59:07 +0000
committerOwen Anderson <resistor@mac.com>2010-08-31 17:59:07 +0000
commit421cc4c9998e5ae1ebd643dfbd25771fe8462ec4 (patch)
tree89933b363d693ba02fd6c4d770d49a37dcc617f3 /test/Transforms/JumpThreading
parent85e75afc8e98f67a05a626f59af05252fb23416d (diff)
downloadllvm-421cc4c9998e5ae1ebd643dfbd25771fe8462ec4.tar.gz
llvm-421cc4c9998e5ae1ebd643dfbd25771fe8462ec4.tar.bz2
llvm-421cc4c9998e5ae1ebd643dfbd25771fe8462ec4.tar.xz
Add a micro-test for the transforms I added to JumpThreading.
I have not been able to find a way to test each in isolation, for a few reasons: 1) The ability to look-through non-i1 BinaryOperator's requires the ability to look through non-constant ICmps in order for it to ever trigger. 2) The ability to do LVI-powered PHI value determination only matters in cases that ProcessBranchOnPHI can't handle. Since it already handles all the cases without other instructions in the def-use chain between the PHI and the branch, it requires the ability to look through ICmps and/or BinaryOperators as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/JumpThreading')
-rw-r--r--test/Transforms/JumpThreading/basic.ll30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll
index ab1ab73f4e..a2a5c1b3fe 100644
--- a/test/Transforms/JumpThreading/basic.ll
+++ b/test/Transforms/JumpThreading/basic.ll
@@ -421,4 +421,34 @@ F2:
; CHECK-NEXT: br i1 %N, label %T2, label %F2
}
+; CHECK: @test14
+define i32 @test14(i32 %in) {
+entry:
+ %A = icmp eq i32 %in, 0
+; CHECK: br i1 %A, label %right_ret, label %merge
+ br i1 %A, label %left, label %right
+
+; CHECK-NOT: left:
+left:
+ br label %merge
+
+; CHECK-NOT: right:
+right:
+ %B = call i32 @f1()
+ br label %merge
+
+merge:
+; CHECK-NOT: %C = phi i32 [%in, %left], [%B, %right]
+ %C = phi i32 [%in, %left], [%B, %right]
+ %D = add i32 %C, 1
+ %E = icmp eq i32 %D, 2
+ br i1 %E, label %left_ret, label %right_ret
+
+; CHECK: left_ret:
+left_ret:
+ ret i32 0
+
+right_ret:
+ ret i32 1
+}