diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-21 03:19:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-21 03:19:28 +0000 |
commit | 2799bafb98676c000388f8636d58064f2646266e (patch) | |
tree | 9ba0bfe171b9b6062d14e2b0573a1802e8687247 /test/Transforms/InstCombine/icmp.ll | |
parent | 6b57a797ab8b82e72b92e772a56b3363cac9d796 (diff) |
Optimize all cases of "icmp (X+Cst), X" to something simpler. This triggers
a bunch in lencode, ldecod, spass, 176.gcc, 252.eon, among others. It is
also the first part of PR5822
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/icmp.ll')
-rw-r--r-- | test/Transforms/InstCombine/icmp.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll index c5dba3f664..f469dd4ef2 100644 --- a/test/Transforms/InstCombine/icmp.ll +++ b/test/Transforms/InstCombine/icmp.ll @@ -62,3 +62,40 @@ define i32 @test6(i32 %a, i32 %b) { ; CHECK-NEXT: %f = and i32 %e, %b ; CHECK-NEXT: ret i32 %f } + + +define i1 @test7(i32 %x) { +entry: + %a = add i32 %x, -1 + %b = icmp ult i32 %a, %x + ret i1 %b +; CHECK: %b = icmp ne i32 %x, 0 +; CHECK: ret i1 %b +} + +define i1 @test8(i32 %x){ +entry: + %a = add i32 %x, -1 + %b = icmp eq i32 %a, %x + ret i1 %b +; CHECK: ret i1 false +} + +define i1 @test9(i32 %x) { +entry: + %a = add i32 %x, -2 + %b = icmp ugt i32 %x, %a + ret i1 %b +; CHECK: icmp ugt i32 %x, 1 +; CHECK: ret i1 %b +} + +define i1 @test10(i32 %x){ +entry: + %a = add i32 %x, -1 + %b = icmp slt i32 %a, %x + ret i1 %b + +; CHECK: %b = icmp ne i32 %x, -2147483648 +; CHECK: ret i1 %b +} |