Skip to content

Commit d99720c

Browse files
committed
Simplify shift constraint to just byte alignment
1 parent 2940b85 commit d99720c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54654,9 +54654,9 @@ static SDValue combineTruncate(SDNode *N, SelectionDAG &DAG,
5465454654
return V;
5465554655

5465654656
// Fold trunc(srl(load(p),amt)) -> load(p+amt/8)
54657-
// If we're shifting down whole byte+pow2 aligned bit chunks from a larger
54658-
// load for truncation, see if we can convert the shift into a pointer
54659-
// offset instead. Limit this to normal (non-ext) scalar integer loads.
54657+
// If we're shifting down byte aligned bit chunks from a larger load for
54658+
// truncation, see if we can convert the shift into a pointer offset instead.
54659+
// Limit this to normal (non-ext) scalar integer loads.
5466054660
if (SrcVT.isScalarInteger() && Src.getOpcode() == ISD::SRL &&
5466154661
Src.hasOneUse() && Src.getOperand(0).hasOneUse() &&
5466254662
ISD::isNormalLoad(Src.getOperand(0).getNode())) {
@@ -54665,9 +54665,9 @@ static SDValue combineTruncate(SDNode *N, SelectionDAG &DAG,
5466554665
isPowerOf2_64(VT.getSizeInBits())) {
5466654666
SDValue ShAmt = Src.getOperand(1);
5466754667
KnownBits KnownAmt = DAG.computeKnownBits(ShAmt);
54668-
// Check the shift amount is aligned to the truncated size.
54668+
// Check the shift amount is byte aligned.
5466954669
// Check the truncation doesn't use any shifted in (zero) top bits.
54670-
if (KnownAmt.countMinTrailingZeros() >= Log2_64(VT.getSizeInBits()) &&
54670+
if (KnownAmt.countMinTrailingZeros() >= 3 &&
5467154671
KnownAmt.getMaxValue().ule(SrcVT.getSizeInBits() -
5467254672
VT.getSizeInBits())) {
5467354673
EVT PtrVT = Ld->getBasePtr().getValueType();

0 commit comments

Comments
 (0)