diff options
author | Duncan Sands <baldrick@free.fr> | 2011-01-14 00:37:45 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2011-01-14 00:37:45 +0000 |
commit | c43cee3fbb3098f0647e50dd2c13bc55b027a228 (patch) | |
tree | 1e584c101d4d96ef46988fd14f156b4e74b21ec4 /test/Transforms/InstCombine | |
parent | 68a659d423b56e3cafcc3751b33e2472bb191048 (diff) | |
download | external_llvm-c43cee3fbb3098f0647e50dd2c13bc55b027a228.zip external_llvm-c43cee3fbb3098f0647e50dd2c13bc55b027a228.tar.gz external_llvm-c43cee3fbb3098f0647e50dd2c13bc55b027a228.tar.bz2 |
Move some shift transforms out of instcombine and into InstructionSimplify.
While there, I noticed that the transform "undef >>a X -> undef" was wrong.
For example if X is 2 then the top two bits must be equal, so the result can
not be anything. I fixed this in the constant folder as well. Also, I made
the transform for "X << undef" stronger: it now folds to undef always, even
though X might be zero. This is in accordance with the LangRef, but I must
admit that it is fairly aggressive. Also, I added "i32 X << 32 -> undef"
following the LangRef and the constant folder, likewise fairly aggressive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/shift.ll | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index 4f6939d..3ae74b5 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -35,18 +35,32 @@ define i32 @test4(i8 %A) { define i32 @test5(i32 %A) { ; CHECK: @test5 -; CHECK: ret i32 0 +; CHECK: ret i32 undef %B = lshr i32 %A, 32 ;; shift all bits out ret i32 %B } define i32 @test5a(i32 %A) { ; CHECK: @test5a -; CHECK: ret i32 0 +; CHECK: ret i32 undef %B = shl i32 %A, 32 ;; shift all bits out ret i32 %B } +define i32 @test5b() { +; CHECK: @test5b +; CHECK: ret i32 -1 + %B = ashr i32 undef, 2 ;; top two bits must be equal, so not undef + ret i32 %B +} + +define i32 @test5b2(i32 %A) { +; CHECK: @test5b2 +; CHECK: ret i32 -1 + %B = ashr i32 undef, %A ;; top %A bits must be equal, so not undef + ret i32 %B +} + define i32 @test6(i32 %A) { ; CHECK: @test6 ; CHECK-NEXT: mul i32 %A, 6 |