1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[KnownBits] Rename KnownBits::computeForMul to KnownBits::mul. NFCI.

As promised in D98866
This commit is contained in:
Simon Pilgrim 2021-03-25 17:04:47 +00:00
parent 334683ea40
commit 8cd06abbb1
8 changed files with 15 additions and 14 deletions

View File

@ -299,7 +299,7 @@ public:
KnownBits RHS);
/// Compute known bits resulting from multiplying LHS and RHS.
static KnownBits computeForMul(const KnownBits &LHS, const KnownBits &RHS);
static KnownBits mul(const KnownBits &LHS, const KnownBits &RHS);
/// Compute known bits from sign-extended multiply-hi.
static KnownBits mulhs(const KnownBits &LHS, const KnownBits &RHS);

View File

@ -462,7 +462,7 @@ static void computeKnownBitsMul(const Value *Op0, const Value *Op1, bool NSW,
}
}
Known = KnownBits::computeForMul(Known, Known2);
Known = KnownBits::mul(Known, Known2);
// Only make use of no-wrap flags if we failed to compute the sign bit
// directly. This matters if the multiplication always overflows, in
@ -1350,7 +1350,7 @@ static void computeKnownBitsFromOperator(const Operator *I,
ScalingFactor =
KnownBits::makeConstant(APInt(IndexBitWidth, TypeSizeInBytes));
}
IndexBits = KnownBits::computeForMul(IndexBits, ScalingFactor);
IndexBits = KnownBits::mul(IndexBits, ScalingFactor);
// If the offsets have a different width from the pointer, according
// to the language reference we need to sign-extend or truncate them

View File

@ -302,7 +302,7 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
Depth + 1);
computeKnownBitsImpl(MI.getOperand(1).getReg(), Known2, DemandedElts,
Depth + 1);
Known = KnownBits::computeForMul(Known, Known2);
Known = KnownBits::mul(Known, Known2);
break;
}
case TargetOpcode::G_SELECT: {

View File

@ -2991,7 +2991,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
case ISD::MUL: {
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
Known = KnownBits::computeForMul(Known, Known2);
Known = KnownBits::mul(Known, Known2);
break;
}
case ISD::MULHU: {
@ -3011,7 +3011,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
if (Op.getResNo() == 0)
Known = KnownBits::computeForMul(Known, Known2);
Known = KnownBits::mul(Known, Known2);
else
Known = KnownBits::mulhu(Known, Known2);
break;
@ -3021,7 +3021,7 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
Known = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
Known2 = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
if (Op.getResNo() == 0)
Known = KnownBits::computeForMul(Known, Known2);
Known = KnownBits::mul(Known, Known2);
else
Known = KnownBits::mulhs(Known, Known2);
break;

View File

@ -412,10 +412,11 @@ KnownBits KnownBits::abs(bool IntMinIsPoison) const {
return KnownAbs;
}
KnownBits KnownBits::computeForMul(const KnownBits &LHS, const KnownBits &RHS) {
KnownBits KnownBits::mul(const KnownBits &LHS, const KnownBits &RHS) {
unsigned BitWidth = LHS.getBitWidth();
assert(BitWidth == RHS.getBitWidth() && !LHS.hasConflict() &&
!RHS.hasConflict() && "Operand mismatch");
assert(!LHS.hasConflict() && !RHS.hasConflict());
// Compute a conservative estimate for high known-0 bits.
unsigned LeadZ =
std::max(LHS.countMinLeadingZeros() + RHS.countMinLeadingZeros(),
@ -497,7 +498,7 @@ KnownBits KnownBits::mulhs(const KnownBits &LHS, const KnownBits &RHS) {
!RHS.hasConflict() && "Operand mismatch");
KnownBits WideLHS = LHS.sext(2 * BitWidth);
KnownBits WideRHS = RHS.sext(2 * BitWidth);
return computeForMul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
return mul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
}
KnownBits KnownBits::mulhu(const KnownBits &LHS, const KnownBits &RHS) {
@ -506,7 +507,7 @@ KnownBits KnownBits::mulhu(const KnownBits &LHS, const KnownBits &RHS) {
!RHS.hasConflict() && "Operand mismatch");
KnownBits WideLHS = LHS.zext(2 * BitWidth);
KnownBits WideRHS = RHS.zext(2 * BitWidth);
return computeForMul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
return mul(WideLHS, WideRHS).extractBits(BitWidth, BitWidth);
}
KnownBits KnownBits::udiv(const KnownBits &LHS, const KnownBits &RHS) {

View File

@ -17785,7 +17785,7 @@ void ARMTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
else if (Op.getOpcode() == ARMISD::CSINV)
std::swap(KnownOp1.Zero, KnownOp1.One);
else if (Op.getOpcode() == ARMISD::CSNEG)
KnownOp1 = KnownBits::computeForMul(
KnownOp1 = KnownBits::mul(
KnownOp1, KnownBits::makeConstant(APInt(32, -1)));
Known = KnownBits::commonBits(KnownOp0, KnownOp1);

View File

@ -34507,7 +34507,7 @@ void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
Known = Known.trunc(BitWidth / 2).zext(BitWidth);
Known2 = Known2.trunc(BitWidth / 2).zext(BitWidth);
Known = KnownBits::computeForMul(Known, Known2);
Known = KnownBits::mul(Known, Known2);
break;
}
case X86ISD::CMOV: {

View File

@ -230,7 +230,7 @@ TEST(KnownBitsTest, BinaryExhaustive) {
// The following are conservatively correct, but not guaranteed to be
// precise.
KnownBits ComputedMul = KnownBits::computeForMul(Known1, Known2);
KnownBits ComputedMul = KnownBits::mul(Known1, Known2);
EXPECT_TRUE(ComputedMul.Zero.isSubsetOf(KnownMul.Zero));
EXPECT_TRUE(ComputedMul.One.isSubsetOf(KnownMul.One));