Skip to content

Commit

Permalink
[X86] foldMaskAndShiftToScale - use MaskedValueIsZero to test for all…
Browse files Browse the repository at this point in the history
…-zero upper bits

We were testing for an exact match of zero bits which isn't necessary (we don't care if lower bits are zero) - by inspection as its proven tricky to get a decent test case.

Noticed while clearing up D155472 regressions
  • Loading branch information
RKSimon committed Aug 24, 2023
1 parent 86258bd commit a0d457b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2108,8 +2108,8 @@ static bool foldMaskAndShiftToScale(SelectionDAG &DAG, SDValue N,
}
APInt MaskedHighBits =
APInt::getHighBitsSet(X.getSimpleValueType().getSizeInBits(), MaskLZ);
KnownBits Known = DAG.computeKnownBits(X);
if (MaskedHighBits != Known.Zero) return true;
if (!DAG.MaskedValueIsZero(X, MaskedHighBits))
return true;

// We've identified a pattern that can be transformed into a single shift
// and an addressing mode. Make it so.
Expand Down

0 comments on commit a0d457b

Please sign in to comment.