@@ -56523,6 +56523,14 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
56523
56523
// Attempt to move shifted index into the address scale, allows further
56524
56524
// index truncation below.
56525
56525
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
+ }
56526
56534
uint64_t ScaleAmt = Scale->getAsZExtVal();
56527
56535
if (auto MinShAmt = DAG.getValidMinimumShiftAmount(Index)) {
56528
56536
if (*MinShAmt >= 1 && (*MinShAmt + Log2_64(ScaleAmt)) < 4 &&
@@ -56588,14 +56596,14 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
56588
56596
56589
56597
EVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
56590
56598
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
+ // }
56599
56607
// Try to move splat adders from the index operand to the base
56600
56608
// pointer operand. Taking care to multiply by the scale. We can only do
56601
56609
// this when index element type is the same as the pointer type.
0 commit comments