summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorJiangning Liu <jiangning.liu@arm.com>2014-08-11 05:02:04 +0000
committerJiangning Liu <jiangning.liu@arm.com>2014-08-11 05:02:04 +0000
commit40b04fd9943857f5e17287ef517a92b59d69a0fe (patch)
tree22e6ff916416cc197a86df88a6d4f17352136bf1 /llvm/test/Transforms
parent941a5709dc4f03ed00273cb2ea7dca91e960de45 (diff)
downloadbcm5719-llvm-40b04fd9943857f5e17287ef517a92b59d69a0fe.tar.gz
bcm5719-llvm-40b04fd9943857f5e17287ef517a92b59d69a0fe.zip
In LVI(Lazy Value Info), originally value on a BB can only be caculated once,
and the lattice will be updated to be a state other than "undefined". This limiation could miss some opportunities of lowering "overdefined" to be an even accurate value. So this patch ask the algorithm to try to lower the lattice value again even if the value has been lowered to be "overdefined". llvm-svn: 215343
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/JumpThreading/jump_threading.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Transforms/JumpThreading/jump_threading.ll b/llvm/test/Transforms/JumpThreading/jump_threading.ll
new file mode 100644
index 00000000000..f5a0ead3d90
--- /dev/null
+++ b/llvm/test/Transforms/JumpThreading/jump_threading.ll
@@ -0,0 +1,33 @@
+; RUN: opt < %s -jump-threading -S | FileCheck %s
+
+define i32 @test_jump_threading(i32* %arg1, i32 %arg2) {
+entry:
+ %cmp = icmp slt i32 %arg2, 0
+ br i1 %cmp, label %land.lhs.true, label %lor.rhs
+
+land.lhs.true:
+ %ident = getelementptr inbounds i32 * %arg1, i64 0
+ %0 = load i32* %ident, align 4
+ %cmp1 = icmp eq i32 %0, 1
+ br i1 %cmp1, label %lor.end, label %lor.rhs
+
+; CHECK: br i1 %cmp1, label %lor.end, label %lor.rhs.thread
+
+; CHECK: lor.rhs.thread:
+; CHECK-NEXT: br label %lor.end
+
+lor.rhs:
+ %cmp2 = icmp sgt i32 %arg2, 0
+ br i1 %cmp2, label %land.rhs, label %lor.end
+
+land.rhs:
+ %ident3 = getelementptr inbounds i32 * %arg1, i64 0
+ %1 = load i32* %ident3, align 4
+ %cmp4 = icmp eq i32 %1, 2
+ br label %lor.end
+
+lor.end:
+ %2 = phi i1 [ true, %land.lhs.true ], [ false, %lor.rhs ], [ %cmp4, %land.rhs ]
+ %lor.ext = zext i1 %2 to i32
+ ret i32 %lor.ext
+}
OpenPOWER on IntegriCloud