aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine/or.ll
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-12-20 16:18:51 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-12-20 16:18:51 +0000
commit5337f20c1516296edcea6bc3da6cdc74329142ae (patch)
treeb344d60db4184b58df32d4eac9a14c511f07601c /test/Transforms/InstCombine/or.ll
parent67e0c212c25f478e4c2ac6c8e9c50cce028fb79c (diff)
downloadexternal_llvm-5337f20c1516296edcea6bc3da6cdc74329142ae.zip
external_llvm-5337f20c1516296edcea6bc3da6cdc74329142ae.tar.gz
external_llvm-5337f20c1516296edcea6bc3da6cdc74329142ae.tar.bz2
Teach InstCombine to merge (icmp ult (X + CA), C1) | (icmp eq X, C2) into (icmp ult (X + CA), C1 + 1) if C2 + CA == C1.
InstCombine creates these so now we compile x == 23 || x == 24 || x == 25 to %x.off = add i32 %x, -23 %1 = icmp ult i32 %x.off, 3 instead of %x.off = add i32 %x, -23 %1 = icmp ult i32 %x.off, 2 %cmp3 = icmp eq i32 %x, 25 %ret2 = or i1 %1, %cmp3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/or.ll')
-rw-r--r--test/Transforms/InstCombine/or.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/or.ll b/test/Transforms/InstCombine/or.ll
index 500cad2..f82f9fa 100644
--- a/test/Transforms/InstCombine/or.ll
+++ b/test/Transforms/InstCombine/or.ll
@@ -376,3 +376,17 @@ define i32 @test35(i32 %a, i32 %b) {
; CHECK-NEXT: or i32 %a, %b
; CHECK-NEXT: or i32 %1, 1135
}
+
+define i1 @test36(i32 %x) {
+ %cmp1 = icmp eq i32 %x, 23
+ %cmp2 = icmp eq i32 %x, 24
+ %ret1 = or i1 %cmp1, %cmp2
+ %cmp3 = icmp eq i32 %x, 25
+ %ret2 = or i1 %ret1, %cmp3
+ ret i1 %ret2
+; CHECK: @test36
+; CHECK-NEXT: %x.off = add i32 %x, -23
+; CHECK-NEXT: icmp ult i32 %x.off, 3
+; CHECK-NEXT: ret i1
+}
+