InstSimplify: shl nsw/nuw undef, %V -> undef

We can always choose an value for undef which might cause %V to shift
out an important bit except for one case, when %V is zero.

However, shl behaves like an identity function when the right hand side
is zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-12-17 01:54:33 +00:00
parent 9451a382ed
commit 891ec6d69f
2 changed files with 35 additions and 13 deletions
+28
View File
@@ -216,3 +216,31 @@ define i32 @test27() {
%b = shl i32 0, undef
ret i32 %b
}
; CHECK-LABEL: @test28
; CHECK: ret i32 undef
define i32 @test28(i32 %a) {
%b = shl nsw i32 undef, %a
ret i32 %b
}
; CHECK-LABEL: @test29
; CHECK: ret i32 undef
define i32 @test29(i32 %a) {
%b = shl nuw i32 undef, %a
ret i32 %b
}
; CHECK-LABEL: @test30
; CHECK: ret i32 undef
define i32 @test30(i32 %a) {
%b = shl nsw nuw i32 undef, %a
ret i32 %b
}
; CHECK-LABEL: @test31
; CHECK: ret i32 0
define i32 @test31(i32 %a) {
%b = shl i32 undef, %a
ret i32 %b
}