@@ -56523,6 +56523,14 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
5652356523 // Attempt to move shifted index into the address scale, allows further
5652456524 // index truncation below.
5652556525 if (Index.getOpcode() == ISD::SHL && isa<ConstantSDNode>(Scale)) {
56526+ unsigned BitWidth = Index.getScalarValueSizeInBits();
56527+ unsigned MaskBits = BitWidth - Log2_32(Scale->getAsZExtVal());
56528+ APInt DemandedBits = APInt::getLowBitsSet(BitWidth, MaskBits);
56529+ if (TLI.SimplifyDemandedBits(Index, DemandedBits, DCI)) {
56530+ if (N->getOpcode() != ISD::DELETED_NODE)
56531+ DCI.AddToWorklist(N);
56532+ return SDValue(N, 0);
56533+ }
5652656534 uint64_t ScaleAmt = Scale->getAsZExtVal();
5652756535 if (auto MinShAmt = DAG.getValidMinimumShiftAmount(Index)) {
5652856536 if (*MinShAmt >= 1 && (*MinShAmt + Log2_64(ScaleAmt)) < 4 &&
@@ -56588,14 +56596,14 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
5658856596
5658956597 EVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
5659056598
56591- if (Index.getOpcode() == ISD::SHL) {
56592- unsigned BitWidth = Index.getScalarValueSizeInBits();
56593- unsigned MaskBits = BitWidth - Log2_32(Scale->getAsZExtVal());
56594- APInt DemandedBits = APInt::getLowBitsSet(BitWidth, MaskBits);
56595- if (TLI.SimplifyDemandedBits(Index, DemandedBits, DCI)) {
56596- return SDValue(N, 0);
56597- }
56598- }
56599+ // if (Index.getOpcode() == ISD::SHL) {
56600+ // unsigned BitWidth = Index.getScalarValueSizeInBits();
56601+ // unsigned MaskBits = BitWidth - Log2_32(Scale->getAsZExtVal());
56602+ // APInt DemandedBits = APInt::getLowBitsSet(BitWidth, MaskBits);
56603+ // if (TLI.SimplifyDemandedBits(Index, DemandedBits, DCI)) {
56604+ // return SDValue(N, 0);
56605+ // }
56606+ // }
5659956607 // Try to move splat adders from the index operand to the base
5660056608 // pointer operand. Taking care to multiply by the scale. We can only do
5660156609 // this when index element type is the same as the pointer type.
0 commit comments