Skip to content

Commit

Permalink
Revert rGbbeb08497ce58 "Revert "[GlobalISel] GISelKnownBits::computeK…
Browse files Browse the repository at this point in the history
…nownBitsImpl - Replace TargetOpcode::G_MUL handling with the common KnownBits::computeForMul implementation""

Updated the GISel KnownBits tests as KnownBits::computeForMul allows more accurate computation.
  • Loading branch information
RKSimon committed Nov 5, 2020
1 parent 6c1a318 commit b257657
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 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
4 changes: 2 additions & 2 deletions llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
Expand Up @@ -300,8 +300,8 @@ TEST_F(AArch64GISelMITest, TestKnownBits) {
GISelKnownBits Info(*MF);
KnownBits Known = Info.getKnownBits(SrcReg);
EXPECT_FALSE(Known.hasConflict());
EXPECT_EQ(0u, Known.One.getZExtValue());
EXPECT_EQ(31u, Known.Zero.getZExtValue());
EXPECT_EQ(32u, Known.One.getZExtValue());
EXPECT_EQ(95u, Known.Zero.getZExtValue());
APInt Zeroes = Info.getKnownZeroes(SrcReg);
EXPECT_EQ(Known.Zero, Zeroes);
}
Expand Down

0 comments on commit b257657

Please sign in to comment.