forked from OSchip/llvm-project
[SCEV] Use reverse() (NFC)
This commit is contained in:
parent
c521288ed3
commit
11a8423dab
|
@ -2822,9 +2822,7 @@ static const SCEV *getExprBase(const SCEV *S) {
|
|||
// there's nothing more complex.
|
||||
// FIXME: not sure if we want to recognize negation.
|
||||
const SCEVAddExpr *Add = cast<SCEVAddExpr>(S);
|
||||
for (std::reverse_iterator<SCEVAddExpr::op_iterator> I(Add->op_end()),
|
||||
E(Add->op_begin()); I != E; ++I) {
|
||||
const SCEV *SubExpr = *I;
|
||||
for (const SCEV *SubExpr : reverse(Add->operands())) {
|
||||
if (SubExpr->getSCEVType() == scAddExpr)
|
||||
return getExprBase(SubExpr);
|
||||
|
||||
|
|
|
@ -747,9 +747,8 @@ Value *SCEVExpander::visitAddExpr(const SCEVAddExpr *S) {
|
|||
// so that pointer operands are inserted first, which the code below relies on
|
||||
// to form more involved GEPs.
|
||||
SmallVector<std::pair<const Loop *, const SCEV *>, 8> OpsAndLoops;
|
||||
for (std::reverse_iterator<SCEVAddExpr::op_iterator> I(S->op_end()),
|
||||
E(S->op_begin()); I != E; ++I)
|
||||
OpsAndLoops.push_back(std::make_pair(getRelevantLoop(*I), *I));
|
||||
for (const SCEV *Op : reverse(S->operands()))
|
||||
OpsAndLoops.push_back(std::make_pair(getRelevantLoop(Op), Op));
|
||||
|
||||
// Sort by loop. Use a stable sort so that constants follow non-constants and
|
||||
// pointer operands precede non-pointer operands.
|
||||
|
@ -811,9 +810,8 @@ Value *SCEVExpander::visitMulExpr(const SCEVMulExpr *S) {
|
|||
// Collect all the mul operands in a loop, along with their associated loops.
|
||||
// Iterate in reverse so that constants are emitted last, all else equal.
|
||||
SmallVector<std::pair<const Loop *, const SCEV *>, 8> OpsAndLoops;
|
||||
for (std::reverse_iterator<SCEVMulExpr::op_iterator> I(S->op_end()),
|
||||
E(S->op_begin()); I != E; ++I)
|
||||
OpsAndLoops.push_back(std::make_pair(getRelevantLoop(*I), *I));
|
||||
for (const SCEV *Op : reverse(S->operands()))
|
||||
OpsAndLoops.push_back(std::make_pair(getRelevantLoop(Op), Op));
|
||||
|
||||
// Sort by loop. Use a stable sort so that constants follow non-constants.
|
||||
llvm::stable_sort(OpsAndLoops, LoopCompare(SE.DT));
|
||||
|
|
Loading…
Reference in New Issue