@@ -19448,12 +19448,12 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
1944819448 std::swap(BasePtr, Offset);
1944919449
1945019450 // Replace other uses of BasePtr that can be updated to use Ptr
19451- for (unsigned i = 0, e = OtherUses.size(); i != e; ++i ) {
19451+ for (SDNode *OtherUse : OtherUses) {
1945219452 unsigned OffsetIdx = 1;
19453- if (OtherUses[i] ->getOperand(OffsetIdx).getNode() == BasePtr.getNode())
19453+ if (OtherUse ->getOperand(OffsetIdx).getNode() == BasePtr.getNode())
1945419454 OffsetIdx = 0;
19455- assert(OtherUses[i] ->getOperand(!OffsetIdx).getNode() ==
19456- BasePtr.getNode() && "Expected BasePtr operand");
19455+ assert(OtherUse ->getOperand(!OffsetIdx).getNode() == BasePtr.getNode() &&
19456+ "Expected BasePtr operand");
1945719457
1945819458 // We need to replace ptr0 in the following expression:
1945919459 // x0 * offset0 + y0 * ptr0 = t0
@@ -19466,11 +19466,11 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
1946619466 // Therefore, we have:
1946719467 // t0 = (x0 * offset0 - x1 * y0 * y1 *offset1) + (y0 * y1) * t1
1946819468
19469- auto *CN = cast<ConstantSDNode>(OtherUses[i] ->getOperand(OffsetIdx));
19469+ auto *CN = cast<ConstantSDNode>(OtherUse ->getOperand(OffsetIdx));
1947019470 const APInt &Offset0 = CN->getAPIntValue();
1947119471 const APInt &Offset1 = Offset->getAsAPIntVal();
19472- int X0 = (OtherUses[i] ->getOpcode() == ISD::SUB && OffsetIdx == 1) ? -1 : 1;
19473- int Y0 = (OtherUses[i] ->getOpcode() == ISD::SUB && OffsetIdx == 0) ? -1 : 1;
19472+ int X0 = (OtherUse ->getOpcode() == ISD::SUB && OffsetIdx == 1) ? -1 : 1;
19473+ int Y0 = (OtherUse ->getOpcode() == ISD::SUB && OffsetIdx == 0) ? -1 : 1;
1947419474 int X1 = (AM == ISD::PRE_DEC && !Swapped) ? -1 : 1;
1947519475 int Y1 = (AM == ISD::PRE_DEC && Swapped) ? -1 : 1;
1947619476
@@ -19481,17 +19481,16 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
1948119481 if (X1 * Y0 * Y1 < 0) CNV = CNV + Offset1;
1948219482 else CNV = CNV - Offset1;
1948319483
19484- SDLoc DL(OtherUses[i] );
19484+ SDLoc DL(OtherUse );
1948519485
1948619486 // We can now generate the new expression.
1948719487 SDValue NewOp1 = DAG.getConstant(CNV, DL, CN->getValueType(0));
1948819488 SDValue NewOp2 = Result.getValue(IsLoad ? 1 : 0);
1948919489
19490- SDValue NewUse = DAG.getNode(Opcode,
19491- DL,
19492- OtherUses[i]->getValueType(0), NewOp1, NewOp2);
19493- DAG.ReplaceAllUsesOfValueWith(SDValue(OtherUses[i], 0), NewUse);
19494- deleteAndRecombine(OtherUses[i]);
19490+ SDValue NewUse =
19491+ DAG.getNode(Opcode, DL, OtherUse->getValueType(0), NewOp1, NewOp2);
19492+ DAG.ReplaceAllUsesOfValueWith(SDValue(OtherUse, 0), NewUse);
19493+ deleteAndRecombine(OtherUse);
1949519494 }
1949619495
1949719496 // Replace the uses of Ptr with uses of the updated base value.
0 commit comments