diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2014-06-19 03:35:49 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2014-06-19 03:35:49 +0000 |
commit | 650b6ea893c118bf0c6e40cd3002954cc34df2bb (patch) | |
tree | 9a7058cb63d32ebe6b4f577dd79e0a93ceb1c898 /test | |
parent | bdb4aca20211b9ed31874c1be0d814fe26f10a24 (diff) | |
download | llvm-650b6ea893c118bf0c6e40cd3002954cc34df2bb.tar.gz llvm-650b6ea893c118bf0c6e40cd3002954cc34df2bb.tar.bz2 llvm-650b6ea893c118bf0c6e40cd3002954cc34df2bb.tar.xz |
Make instsimplify's analysis of icmp eq/ne use computeKnownBits to determine whether the icmp is always true or false. Patch by Suyog Sarda!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/align-2d-gep.ll | 2 | ||||
-rw-r--r-- | test/Transforms/InstSimplify/compare.ll | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/align-2d-gep.ll b/test/Transforms/InstCombine/align-2d-gep.ll index 5bca46d5a2..f6a877684c 100644 --- a/test/Transforms/InstCombine/align-2d-gep.ll +++ b/test/Transforms/InstCombine/align-2d-gep.ll @@ -31,7 +31,7 @@ bb1: store <2 x double><double 0.0, double 0.0>, <2 x double>* %r, align 8 %indvar.next = add i64 %j, 2 - %exitcond = icmp eq i64 %indvar.next, 557 + %exitcond = icmp eq i64 %indvar.next, 556 br i1 %exitcond, label %bb11, label %bb1 bb11: diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll index 105e244ed8..89fd6362d7 100644 --- a/test/Transforms/InstSimplify/compare.ll +++ b/test/Transforms/InstSimplify/compare.ll @@ -883,3 +883,22 @@ define i1 @returns_nonnull() { ; CHECK: ret i1 false } +; If a bit is known to be zero for A and known to be one for B, +; then A and B cannot be equal. +define i1 @icmp_eq_const(i32 %a) nounwind { + %b = mul nsw i32 %a, -2 + %c = icmp eq i32 %b, 1 + ret i1 %c + +; CHECK-LABEL: @icmp_eq_const +; CHECK-NEXT: ret i1 false +} + +define i1 @icmp_ne_const(i32 %a) nounwind { + %b = mul nsw i32 %a, -2 + %c = icmp ne i32 %b, 1 + ret i1 %c + +; CHECK-LABEL: @icmp_ne_const +; CHECK-NEXT: ret i1 true +} |