mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-26 05:56:12 +00:00
[ValueTracking] Prevent a call to computeKnownBits if we already know the state of the bit we would calculate. Also reuse a temporary APInt instead of creating a new one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300239 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0bd00d7d97
commit
e1c6ddcf64
@ -918,13 +918,14 @@ static void computeKnownBitsFromOperator(const Operator *I, APInt &KnownZero,
|
|||||||
// TODO: This could be generalized to clearing any bit set in y where the
|
// TODO: This could be generalized to clearing any bit set in y where the
|
||||||
// following bit is known to be unset in y.
|
// following bit is known to be unset in y.
|
||||||
Value *Y = nullptr;
|
Value *Y = nullptr;
|
||||||
if (match(I->getOperand(0), m_Add(m_Specific(I->getOperand(1)),
|
if (!KnownZero[0] && !KnownOne[0] &&
|
||||||
m_Value(Y))) ||
|
(match(I->getOperand(0), m_Add(m_Specific(I->getOperand(1)),
|
||||||
match(I->getOperand(1), m_Add(m_Specific(I->getOperand(0)),
|
m_Value(Y))) ||
|
||||||
m_Value(Y)))) {
|
match(I->getOperand(1), m_Add(m_Specific(I->getOperand(0)),
|
||||||
APInt KnownZero3(BitWidth, 0), KnownOne3(BitWidth, 0);
|
m_Value(Y))))) {
|
||||||
computeKnownBits(Y, KnownZero3, KnownOne3, Depth + 1, Q);
|
KnownZero2.clearAllBits(); KnownOne2.clearAllBits();
|
||||||
if (KnownOne3.countTrailingOnes() > 0)
|
computeKnownBits(Y, KnownZero2, KnownOne2, Depth + 1, Q);
|
||||||
|
if (KnownOne2.countTrailingOnes() > 0)
|
||||||
KnownZero.setBit(0);
|
KnownZero.setBit(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user