mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122529 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -168,8 +168,9 @@ static bool CanEvaluateShifted(Value *V, unsigned NumBits, bool isLeftShift,
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user