Transform (A == C1 || A == C2) into (A & ~(C1 ^ C2)) == C1

if C1 and C2 differ only with one bit.
Fixes PR14708.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171270 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakub Staszak
2012-12-31 00:34:55 +00:00
parent 6eb7a4270b
commit d60b8ac64f
2 changed files with 23 additions and 0 deletions

View File

@@ -694,3 +694,14 @@ define i1 @test68(i32 %x) nounwind uwtable {
%cmp = icmp sgt i32 %and, 30
ret i1 %cmp
}
; PR14708
; CHECK: @test69
; CHECK: %1 = and i32 %c, -33
; CHECK: %2 = icmp eq i32 %1, 65
define i1 @test69(i32 %c) nounwind uwtable {
%1 = icmp eq i32 %c, 97
%2 = icmp eq i32 %c, 65
%3 = or i1 %1, %2
ret i1 %3
}