Skip to content

Commit

Permalink
[GlobalISel] GISelKnownBits::computeKnownBitsImpl - Replace TargetOpc…
Browse files Browse the repository at this point in the history
…ode::G_MUL handling with the common KnownBits::computeForMul implementation

Avoid code duplication
  • Loading branch information
RKSimon committed Nov 4, 2020
1 parent 3ebcef4 commit 0b8711e
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
Expand Up @@ -287,20 +287,7 @@ void GISelKnownBits::computeKnownBitsImpl(Register R, KnownBits &Known,
Depth + 1);
computeKnownBitsImpl(MI.getOperand(1).getReg(), Known2, DemandedElts,
Depth + 1);
// 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));
Known = KnownBits::computeForMul(Known, Known2);
break;
}
case TargetOpcode::G_SELECT: {
Expand Down

0 comments on commit 0b8711e

Please sign in to comment.