mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Really check that the bits that will become zero are actually already zero
before eliminating the operation that zeros them. This fixes rdar://8739316. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -168,9 +168,8 @@ 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, LowBits) << NumBits))
|
||||
APInt::getLowBitsSet(TypeWidth, NumBits)))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user