mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
Always compute all the bits in ComputeMaskedBits.
This allows us to keep passing reduced masks to SimplifyDemandedBits, but know about all the bits if SimplifyDemandedBits fails. This allows instcombine to simplify cases like the one in the included testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3261,9 +3261,8 @@ ScalarEvolution::GetMinTrailingZeros(const SCEV *S) {
|
||||
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
|
||||
// For a SCEVUnknown, ask ValueTracking.
|
||||
unsigned BitWidth = getTypeSizeInBits(U->getType());
|
||||
APInt Mask = APInt::getAllOnesValue(BitWidth);
|
||||
APInt Zeros(BitWidth, 0), Ones(BitWidth, 0);
|
||||
ComputeMaskedBits(U->getValue(), Mask, Zeros, Ones);
|
||||
ComputeMaskedBits(U->getValue(), Zeros, Ones);
|
||||
return Zeros.countTrailingOnes();
|
||||
}
|
||||
|
||||
@@ -3401,9 +3400,8 @@ ScalarEvolution::getUnsignedRange(const SCEV *S) {
|
||||
|
||||
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(S)) {
|
||||
// For a SCEVUnknown, ask ValueTracking.
|
||||
APInt Mask = APInt::getAllOnesValue(BitWidth);
|
||||
APInt Zeros(BitWidth, 0), Ones(BitWidth, 0);
|
||||
ComputeMaskedBits(U->getValue(), Mask, Zeros, Ones, TD);
|
||||
ComputeMaskedBits(U->getValue(), Zeros, Ones, TD);
|
||||
if (Ones == ~Zeros + 1)
|
||||
return setUnsignedRange(U, ConservativeResult);
|
||||
return setUnsignedRange(U,
|
||||
@@ -3660,9 +3658,8 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
|
||||
// knew about to reconstruct a low-bits mask value.
|
||||
unsigned LZ = A.countLeadingZeros();
|
||||
unsigned BitWidth = A.getBitWidth();
|
||||
APInt AllOnes = APInt::getAllOnesValue(BitWidth);
|
||||
APInt KnownZero(BitWidth, 0), KnownOne(BitWidth, 0);
|
||||
ComputeMaskedBits(U->getOperand(0), AllOnes, KnownZero, KnownOne, TD);
|
||||
ComputeMaskedBits(U->getOperand(0), KnownZero, KnownOne, TD);
|
||||
|
||||
APInt EffectiveMask = APInt::getLowBitsSet(BitWidth, BitWidth - LZ);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user