diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /test/Transforms/JumpThreading/assume-edge-dom.ll | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'test/Transforms/JumpThreading/assume-edge-dom.ll')
-rw-r--r-- | test/Transforms/JumpThreading/assume-edge-dom.ll | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/assume-edge-dom.ll b/test/Transforms/JumpThreading/assume-edge-dom.ll new file mode 100644 index 0000000..f1d0f41 --- /dev/null +++ b/test/Transforms/JumpThreading/assume-edge-dom.ll @@ -0,0 +1,39 @@ +; RUN: opt -S -jump-threading < %s | FileCheck %s + +declare i8* @escape() +declare void @llvm.assume(i1) + +define i1 @test1(i1 %cond) { +entry: + br i1 %cond, label %taken, label %not_taken + +; CHECK-LABEL: @test1 +; CHECK: br i1 %cond, label %no, label %yes +; CHECK: ret i1 true + +taken: + %res1 = call i8* @escape() + %a = icmp eq i8* %res1, null + tail call void @llvm.assume(i1 %a) + br label %done +not_taken: + %res2 = call i8* @escape() + %b = icmp ne i8* %res2, null + tail call void @llvm.assume(i1 %b) + br label %done + +; An assume that can be used to simplify this comparison dominates each +; predecessor branch (although no assume dominates the cmp itself). Make sure +; this still can be simplified. + +done: + %res = phi i8* [ %res1, %taken ], [ %res2, %not_taken ] + %cnd = icmp ne i8* %res, null + br i1 %cnd, label %yes, label %no + +yes: + ret i1 true +no: + ret i1 false +} + |