aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/sign-test-and-or.ll
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-02-11 21:09:03 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-02-11 21:09:03 +0000
commit1e6240a85ddafbd35af931958d38b79b6683f23b (patch)
treeec52412741e2a5fcc6deb1d01f581345318a98f2 /test/Transforms/InstCombine/sign-test-and-or.ll
parent75bf59280711c9f45b10d18ed14b63de9718c0e2 (diff)
InstCombine: Teach icmp merging about the equivalence of bit tests and UGE/ULT with a power of 2.
This happens in bitfield code. While there reorganize the existing code a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201176 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/sign-test-and-or.ll')
-rw-r--r--test/Transforms/InstCombine/sign-test-and-or.ll38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/sign-test-and-or.ll b/test/Transforms/InstCombine/sign-test-and-or.ll
index 95ed9b976ba..aa23d933b09 100644
--- a/test/Transforms/InstCombine/sign-test-and-or.ll
+++ b/test/Transforms/InstCombine/sign-test-and-or.ll
@@ -177,3 +177,41 @@ if.then:
if.end:
ret void
}
+
+define void @test10(i32 %a) nounwind {
+ %1 = and i32 %a, 2
+ %2 = icmp eq i32 %1, 0
+ %3 = icmp ult i32 %a, 4
+ %or.cond = and i1 %2, %3
+ br i1 %or.cond, label %if.then, label %if.end
+
+; CHECK-LABEL: @test10(
+; CHECK-NEXT: %1 = icmp ult i32 %a, 2
+; CHECK-NEXT: br i1 %1, label %if.then, label %if.end
+
+if.then:
+ tail call void @foo() nounwind
+ ret void
+
+if.end:
+ ret void
+}
+
+define void @test11(i32 %a) nounwind {
+ %1 = and i32 %a, 2
+ %2 = icmp ne i32 %1, 0
+ %3 = icmp ugt i32 %a, 3
+ %or.cond = or i1 %2, %3
+ br i1 %or.cond, label %if.then, label %if.end
+
+; CHECK-LABEL: @test11(
+; CHECK-NEXT: %1 = icmp ugt i32 %a, 1
+; CHECK-NEXT: br i1 %1, label %if.then, label %if.end
+
+if.then:
+ tail call void @foo() nounwind
+ ret void
+
+if.end:
+ ret void
+}