@@ -747,9 +747,8 @@ Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) {
747
747
// so that pointer operands are inserted first, which the code below relies on
748
748
// to form more involved GEPs.
749
749
SmallVector<std::pair<const Loop *, const SCEV *>, 8 > OpsAndLoops;
750
- for (std::reverse_iterator<SCEVAddExpr::op_iterator> I (S->op_end ()),
751
- E (S->op_begin ()); I != E; ++I)
752
- OpsAndLoops.push_back (std::make_pair (getRelevantLoop (*I), *I));
750
+ for (const SCEV *Op : reverse (S->operands ()))
751
+ OpsAndLoops.push_back (std::make_pair (getRelevantLoop (Op), Op));
753
752
754
753
// Sort by loop. Use a stable sort so that constants follow non-constants and
755
754
// pointer operands precede non-pointer operands.
@@ -811,9 +810,8 @@ Value *SCEVExpander::visitMulExpr(const SCEVMulExpr *S) {
811
810
// Collect all the mul operands in a loop, along with their associated loops.
812
811
// Iterate in reverse so that constants are emitted last, all else equal.
813
812
SmallVector<std::pair<const Loop *, const SCEV *>, 8 > OpsAndLoops;
814
- for (std::reverse_iterator<SCEVMulExpr::op_iterator> I (S->op_end ()),
815
- E (S->op_begin ()); I != E; ++I)
816
- OpsAndLoops.push_back (std::make_pair (getRelevantLoop (*I), *I));
813
+ for (const SCEV *Op : reverse (S->operands ()))
814
+ OpsAndLoops.push_back (std::make_pair (getRelevantLoop (Op), Op));
817
815
818
816
// Sort by loop. Use a stable sort so that constants follow non-constants.
819
817
llvm::stable_sort (OpsAndLoops, LoopCompare (SE.DT ));
0 commit comments