@@ -2615,16 +2615,16 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
26152615 bool Ok = true;
26162616 // Check all the operands to see if they can be represented in the
26172617 // source type of the truncate.
2618- for (unsigned i = 0, e = Ops.size(); i != e; ++i ) {
2619- if (const SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(Ops[i] )) {
2618+ for (const SCEV *Op : Ops) {
2619+ if (const SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(Op )) {
26202620 if (T->getOperand()->getType() != SrcType) {
26212621 Ok = false;
26222622 break;
26232623 }
26242624 LargeOps.push_back(T->getOperand());
2625- } else if (const SCEVConstant *C = dyn_cast<SCEVConstant>(Ops[i] )) {
2625+ } else if (const SCEVConstant *C = dyn_cast<SCEVConstant>(Op )) {
26262626 LargeOps.push_back(getAnyExtendExpr(C, SrcType));
2627- } else if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(Ops[i] )) {
2627+ } else if (const SCEVMulExpr *M = dyn_cast<SCEVMulExpr>(Op )) {
26282628 SmallVector<const SCEV *, 8> LargeMulOps;
26292629 for (unsigned j = 0, f = M->getNumOperands(); j != f && Ok; ++j) {
26302630 if (const SCEVTruncateExpr *T =
@@ -3668,13 +3668,13 @@ ScalarEvolution::getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands,
36683668 if (Operands.size() == 1) return Operands[0];
36693669#ifndef NDEBUG
36703670 Type *ETy = getEffectiveSCEVType(Operands[0]->getType());
3671- for (unsigned i = 1, e = Operands.size(); i != e; ++i ) {
3672- assert(getEffectiveSCEVType(Operands[i] ->getType()) == ETy &&
3671+ for (const SCEV *Op : llvm::drop_begin(Operands) ) {
3672+ assert(getEffectiveSCEVType(Op ->getType()) == ETy &&
36733673 "SCEVAddRecExpr operand types don't match!");
3674- assert(!Operands[i] ->getType()->isPointerTy() && "Step must be integer");
3674+ assert(!Op ->getType()->isPointerTy() && "Step must be integer");
36753675 }
3676- for (unsigned i = 0, e = Operands.size(); i != e; ++i )
3677- assert(isAvailableAtLoopEntry(Operands[i] , L) &&
3676+ for (const SCEV *Op : Operands)
3677+ assert(isAvailableAtLoopEntry(Op , L) &&
36783678 "SCEVAddRecExpr operand is not available at loop entry!");
36793679#endif
36803680
@@ -3958,8 +3958,8 @@ const SCEV *ScalarEvolution::getMinMaxExpr(SCEVTypes Kind,
39583958 // already have one, otherwise create a new one.
39593959 FoldingSetNodeID ID;
39603960 ID.AddInteger(Kind);
3961- for (unsigned i = 0, e = Ops.size(); i != e; ++i )
3962- ID.AddPointer(Ops[i] );
3961+ for (const SCEV *Op : Ops)
3962+ ID.AddPointer(Op );
39633963 void *IP = nullptr;
39643964 const SCEV *ExistingSCEV = UniqueSCEVs.FindNodeOrInsertPos(ID, IP);
39653965 if (ExistingSCEV)
@@ -4345,8 +4345,8 @@ ScalarEvolution::getSequentialMinMaxExpr(SCEVTypes Kind,
43454345 // already have one, otherwise create a new one.
43464346 FoldingSetNodeID ID;
43474347 ID.AddInteger(Kind);
4348- for (unsigned i = 0, e = Ops.size(); i != e; ++i )
4349- ID.AddPointer(Ops[i] );
4348+ for (const SCEV *Op : Ops)
4349+ ID.AddPointer(Op );
43504350 void *IP = nullptr;
43514351 const SCEV *ExistingSCEV = UniqueSCEVs.FindNodeOrInsertPos(ID, IP);
43524352 if (ExistingSCEV)
@@ -8785,9 +8785,7 @@ ScalarEvolution::computeBackedgeTakenCount(const Loop *L,
87858785 // Compute the ExitLimit for each loop exit. Use this to populate ExitCounts
87868786 // and compute maxBECount.
87878787 // Do a union of all the predicates here.
8788- for (unsigned i = 0, e = ExitingBlocks.size(); i != e; ++i) {
8789- BasicBlock *ExitBB = ExitingBlocks[i];
8790-
8788+ for (BasicBlock *ExitBB : ExitingBlocks) {
87918789 // We canonicalize untaken exits to br (constant), ignore them so that
87928790 // proving an exit untaken doesn't negatively impact our ability to reason
87938791 // about the loop as whole.
0 commit comments