diff options
author | Duncan Sands <baldrick@free.fr> | 2011-02-13 17:15:40 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-02-13 17:15:40 +0000 |
commit | 52fb846578714d14bbde9b28884a6a8729217677 (patch) | |
tree | f4d88f87e540573a6f5144fdeb4f12ee021551b9 /test | |
parent | d239e5af64a7d4b0e6dcf7bc1cabefdaece72268 (diff) | |
download | llvm-52fb846578714d14bbde9b28884a6a8729217677.tar.gz llvm-52fb846578714d14bbde9b28884a6a8729217677.tar.bz2 llvm-52fb846578714d14bbde9b28884a6a8729217677.tar.xz |
Teach instsimplify that X+Y>=X+Z is the same as Y>=Z if neither side overflows,
plus some variations of this. According to my auto-simplifier this occurs a lot
but usually in combination with max/min idioms. Because max/min aren't handled
yet this unfortunately doesn't have much effect in the testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125462 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstSimplify/compare.ll (renamed from test/Transforms/InstSimplify/2011-01-18-Compare.ll) | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/2011-01-18-Compare.ll b/test/Transforms/InstSimplify/compare.ll index e08ee2c6fb..250e44ce34 100644 --- a/test/Transforms/InstSimplify/2011-01-18-Compare.ll +++ b/test/Transforms/InstSimplify/compare.ll @@ -91,6 +91,26 @@ define i1 @add3(i8 %x, i8 %y) { ; CHECK: ret i1 %c } +define i1 @add4(i32 %x, i32 %y) { +; CHECK: @add4 + %z = add nsw i32 %y, 1 + %s1 = add nsw i32 %x, %y + %s2 = add nsw i32 %x, %z + %c = icmp slt i32 %s1, %s2 + ret i1 %c +; CHECK: ret i1 true +} + +define i1 @add5(i32 %x, i32 %y) { +; CHECK: @add5 + %z = add nuw i32 %y, 1 + %s1 = add nuw i32 %x, %z + %s2 = add nuw i32 %x, %y + %c = icmp ugt i32 %s1, %s2 + ret i1 %c +; CHECK: ret i1 true +} + define i1 @addpowtwo(i32 %x, i32 %y) { ; CHECK: @addpowtwo %l = lshr i32 %x, 1 |