diff options
author | Duncan Sands <baldrick@free.fr> | 2011-02-17 07:46:37 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-02-17 07:46:37 +0000 |
commit | a77243300ba1a40c80c0f8417ba74bb76e7de279 (patch) | |
tree | a131e17994d3201e93c709d58ae876c68dd1cd64 /test | |
parent | 2598b1f4ac3d8242bb3821414f86e388b24c6046 (diff) | |
download | llvm-a77243300ba1a40c80c0f8417ba74bb76e7de279.tar.gz llvm-a77243300ba1a40c80c0f8417ba74bb76e7de279.tar.bz2 llvm-a77243300ba1a40c80c0f8417ba74bb76e7de279.tar.xz |
Transform "A + B >= A + C" into "B >= C" if the adds do not wrap. Likewise for some
variations (some of these were already present so I unified the code). Spotted by my
auto-simplifier as occurring a lot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/icmp.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll index 72ada2476f..08718affa0 100644 --- a/test/Transforms/InstCombine/icmp.ll +++ b/test/Transforms/InstCombine/icmp.ll @@ -234,3 +234,22 @@ define i1 @test24(i64 %i) { ret i1 %cmp } +; CHECK: @test25 +; CHECK: %c = icmp sgt i32 %x, %y +; CHECK: ret i1 %c +define i1 @test25(i32 %x, i32 %y, i32 %z) { + %lhs = add nsw i32 %x, %z + %rhs = add nsw i32 %y, %z + %c = icmp sgt i32 %lhs, %rhs + ret i1 %c +} + +; CHECK: @test26 +; CHECK: %c = icmp sgt i32 %x, %y +; CHECK: ret i1 %c +define i1 @test26(i32 %x, i32 %y, i32 %z) { + %lhs = sub nsw i32 %x, %z + %rhs = sub nsw i32 %y, %z + %c = icmp sgt i32 %lhs, %rhs + ret i1 %c +} |