Revert "[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpcode::G_MUL handling with the common KnownBits::computeForMul implementation"

This reverts commit 0b8711e1af which broke GlobalISelTests AArch64GISelMITest.TestKnownBits
This commit is contained in:
Fangrui Song 2020-11-04 09:54:04 -08:00
parent d8f531c42c
commit bbeb08497c
1 changed files with 14 additions and 1 deletions

View File

@ -287,7 +287,20 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
Depth + 1); Depth + 1);
computeKnownBitsImpl(MI.getOperand(1).getReg(), Known2, DemandedElts, computeKnownBitsImpl(MI.getOperand(1).getReg(), Known2, DemandedElts,
Depth + 1); Depth + 1);
Known = KnownBits::computeForMul(Known, Known2); // If low bits are zero in either operand, output low known-0 bits.
// Also compute a conservative estimate for high known-0 bits.
// More trickiness is possible, but this is sufficient for the
// interesting case of alignment computation.
unsigned TrailZ =
Known.countMinTrailingZeros() + Known2.countMinTrailingZeros();
unsigned LeadZ =
std::max(Known.countMinLeadingZeros() + Known2.countMinLeadingZeros(),
BitWidth) -
BitWidth;
Known.resetAll();
Known.Zero.setLowBits(std::min(TrailZ, BitWidth));
Known.Zero.setHighBits(std::min(LeadZ, BitWidth));
break; break;
} }
case TargetOpcode::G_SELECT: { case TargetOpcode::G_SELECT: {