optimize:

void a(int x) { if (((1<<x)&8)==0) b(); }

into "x != 3", which occurs over 100 times in 403.gcc but in no
other program in llvm-test.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-11-21 06:44:42 +00:00
parent 79a980ad85
commit 75d8f599e7
3 changed files with 110 additions and 10 deletions

View File

@@ -154,3 +154,41 @@ entry:
; CHECK: @test16
; CHECK: ret i1 undef
}
define i1 @test17(i32 %x) nounwind {
%shl = shl i32 1, %x
%and = and i32 %shl, 8
%cmp = icmp eq i32 %and, 0
ret i1 %cmp
; CHECK: @test17
; CHECK-NEXT: %cmp = icmp eq i32 %x, 3
}
define i1 @test18(i32 %x) nounwind {
%sh = lshr i32 8, %x
%and = and i32 %sh, 1
%cmp = icmp eq i32 %and, 0
ret i1 %cmp
; CHECK: @test18
; CHECK-NEXT: %cmp = icmp eq i32 %x, 3
}
define i1 @test19(i32 %x) nounwind {
%shl = shl i32 1, %x
%and = and i32 %shl, 8
%cmp = icmp eq i32 %and, 8
ret i1 %cmp
; CHECK: @test19
; CHECK-NEXT: %cmp = icmp ne i32 %x, 3
}
define i1 @test20(i32 %x) nounwind {
%shl = shl i32 1, %x
%and = and i32 %shl, 8
%cmp = icmp ne i32 %and, 0
ret i1 %cmp
; CHECK: @test20
; CHECK-NEXT: %cmp = icmp ne i32 %x, 3
}