diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-06-13 15:24:24 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-06-13 15:24:24 +0000 |
commit | e7fdcad2f2d82c81684cb9962327330786c35107 (patch) | |
tree | 0d09ca97eca2b511ba3c23058a6b46568dd8967b /test/Transforms | |
parent | aa99bea46f69f9cc46f3f50f2cb19e801641ed97 (diff) | |
download | external_llvm-e7fdcad2f2d82c81684cb9962327330786c35107.zip external_llvm-e7fdcad2f2d82c81684cb9962327330786c35107.tar.gz external_llvm-e7fdcad2f2d82c81684cb9962327330786c35107.tar.bz2 |
InstCombine: Fold A-b == C --> b == A-C if A and C are constants.
The backend already knew this trick.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/icmp.ll | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll index ecbba23..c8f7f81 100644 --- a/test/Transforms/InstCombine/icmp.ll +++ b/test/Transforms/InstCombine/icmp.ll @@ -531,3 +531,19 @@ define i1 @test54(i8 %a) nounwind { %ret = icmp eq i32 %and, 128 ret i1 %ret } + +; CHECK: @test55 +; CHECK-NEXT: icmp eq i32 %a, -123 +define i1 @test55(i32 %a) { + %sub = sub i32 0, %a + %cmp = icmp eq i32 %sub, 123 + ret i1 %cmp +} + +; CHECK: @test56 +; CHECK-NEXT: icmp eq i32 %a, -113 +define i1 @test56(i32 %a) { + %sub = sub i32 10, %a + %cmp = icmp eq i32 %sub, 123 + ret i1 %cmp +} |