[llvm-branch-commits] [llvm-branch] r123011 - in /llvm/branches/Apple/whitney: lib/Transforms/InstCombine/InstCombineShifts.cpp test/Transforms/InstCombine/shift.ll
Daniel Dunbar
daniel at zuster.org
Fri Jan 7 11:32:38 PST 2011
Author: ddunbar
Date: Fri Jan 7 13:32:38 2011
New Revision: 123011
URL: http://llvm.org/viewvc/llvm-project?rev=123011&view=rev
Log:
Merge r122529:
--
Author: Owen Anderson <owen at apple.com>
Date: Thu Dec 23 23:56:24 2010 +0000
When determining if we can fold (x >> C1) << C2, the bits that we need to verify are zero
are not the low bits of x, but the bits that WILL be the low bits after the operation completes.
Modified:
llvm/branches/Apple/whitney/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/branches/Apple/whitney/test/Transforms/InstCombine/shift.ll
Modified: llvm/branches/Apple/whitney/lib/Transforms/InstCombine/InstCombineShifts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Transforms/InstCombine/InstCombineShifts.cpp?rev=123011&r1=123010&r2=123011&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Transforms/InstCombine/InstCombineShifts.cpp (original)
+++ llvm/branches/Apple/whitney/lib/Transforms/InstCombine/InstCombineShifts.cpp Fri Jan 7 13:32:38 2011
@@ -155,8 +155,9 @@
// We can always turn lshr(c1)+shl(c2) -> lshr(c3)+and(c4), but it isn't
// profitable unless we know the and'd out bits are already zero.
if (CI->getZExtValue() > NumBits) {
+ unsigned LowBits = CI->getZExtValue() - NumBits;
if (MaskedValueIsZero(I->getOperand(0),
- APInt::getLowBitsSet(TypeWidth, NumBits)))
+ APInt::getLowBitsSet(TypeWidth, NumBits) << LowBits))
return true;
}
Modified: llvm/branches/Apple/whitney/test/Transforms/InstCombine/shift.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/test/Transforms/InstCombine/shift.ll?rev=123011&r1=123010&r2=123011&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/test/Transforms/InstCombine/shift.ll (original)
+++ llvm/branches/Apple/whitney/test/Transforms/InstCombine/shift.ll Fri Jan 7 13:32:38 2011
@@ -441,3 +441,22 @@
; CHECK: %ins = or i128 %tmp23, %A
; CHECK: %tmp46 = trunc i128 %ins to i64
}
+; <rdar://problem/8756731>
+; CHECK: @test39
+define i8 @test39(i32 %a0) {
+entry:
+ %tmp4 = trunc i32 %a0 to i8
+; CHECK: and i8 %tmp49, 64
+ %tmp5 = shl i8 %tmp4, 5
+ %tmp48 = and i8 %tmp5, 32
+ %tmp49 = lshr i8 %tmp48, 5
+ %tmp50 = mul i8 %tmp49, 64
+ %tmp51 = xor i8 %tmp50, %tmp5
+; CHECK: and i8 %0, 16
+ %tmp52 = and i8 %tmp51, -128
+ %tmp53 = lshr i8 %tmp52, 7
+ %tmp54 = mul i8 %tmp53, 16
+ %tmp55 = xor i8 %tmp54, %tmp51
+; CHECK: ret i8 %tmp551
+ ret i8 %tmp55
+}
More information about the llvm-branch-commits
mailing list