diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2014-12-17 01:54:33 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2014-12-17 01:54:33 +0000 |
| commit | 65c52ae8ca180cf54094cb78045e18ba82aec46e (patch) | |
| tree | 9db5d71b17bdd9f65aef0c182cdf2ebe33dd59a4 /llvm/test/Transforms | |
| parent | ee0a3a7a2f018a5d40015b853210b726a8a8b635 (diff) | |
| download | bcm5719-llvm-65c52ae8ca180cf54094cb78045e18ba82aec46e.tar.gz bcm5719-llvm-65c52ae8ca180cf54094cb78045e18ba82aec46e.zip | |
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.
llvm-svn: 224405
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstSimplify/undef.ll | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/undef.ll b/llvm/test/Transforms/InstSimplify/undef.ll index 70a07b8a892..bf643171cc1 100644 --- a/llvm/test/Transforms/InstSimplify/undef.ll +++ b/llvm/test/Transforms/InstSimplify/undef.ll @@ -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 +} |

