@@ -19448,12 +19448,12 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
19448
19448
std::swap(BasePtr, Offset);
19449
19449
19450
19450
// 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) {
19452
19452
unsigned OffsetIdx = 1;
19453
- if (OtherUses[i] ->getOperand(OffsetIdx).getNode() == BasePtr.getNode())
19453
+ if (OtherUse ->getOperand(OffsetIdx).getNode() == BasePtr.getNode())
19454
19454
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");
19457
19457
19458
19458
// We need to replace ptr0 in the following expression:
19459
19459
// x0 * offset0 + y0 * ptr0 = t0
@@ -19466,11 +19466,11 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
19466
19466
// Therefore, we have:
19467
19467
// t0 = (x0 * offset0 - x1 * y0 * y1 *offset1) + (y0 * y1) * t1
19468
19468
19469
- auto *CN = cast<ConstantSDNode>(OtherUses[i] ->getOperand(OffsetIdx));
19469
+ auto *CN = cast<ConstantSDNode>(OtherUse ->getOperand(OffsetIdx));
19470
19470
const APInt &Offset0 = CN->getAPIntValue();
19471
19471
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;
19474
19474
int X1 = (AM == ISD::PRE_DEC && !Swapped) ? -1 : 1;
19475
19475
int Y1 = (AM == ISD::PRE_DEC && Swapped) ? -1 : 1;
19476
19476
@@ -19481,17 +19481,16 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
19481
19481
if (X1 * Y0 * Y1 < 0) CNV = CNV + Offset1;
19482
19482
else CNV = CNV - Offset1;
19483
19483
19484
- SDLoc DL(OtherUses[i] );
19484
+ SDLoc DL(OtherUse );
19485
19485
19486
19486
// We can now generate the new expression.
19487
19487
SDValue NewOp1 = DAG.getConstant(CNV, DL, CN->getValueType(0));
19488
19488
SDValue NewOp2 = Result.getValue(IsLoad ? 1 : 0);
19489
19489
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);
19495
19494
}
19496
19495
19497
19496
// Replace the uses of Ptr with uses of the updated base value.
0 commit comments