LoopRerollPass.cpp: Use range-based loop. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220772 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2014-10-28 11:54:05 +00:00
parent 0f06462959
commit 2ffeb9f523

View File

@ -241,10 +241,9 @@ protected:
PossibleRedSet.insert(PossibleReds[i].getPHI()); PossibleRedSet.insert(PossibleReds[i].getPHI());
PossibleRedIdx[PossibleReds[i].getPHI()] = i; PossibleRedIdx[PossibleReds[i].getPHI()] = i;
for (SimpleLoopReduction::iterator J = PossibleReds[i].begin(), for (Instruction *J : PossibleReds[i]) {
JE = PossibleReds[i].end(); J != JE; ++J) { PossibleRedSet.insert(J);
PossibleRedSet.insert(*J); PossibleRedIdx[J] = i;
PossibleRedIdx[*J] = i;
} }
} }
} }
@ -659,16 +658,15 @@ bool LoopReroll::ReductionTracker::validateSelected() {
RI != RIE; ++RI) { RI != RIE; ++RI) {
int i = *RI; int i = *RI;
int PrevIter = 0, BaseCount = 0, Count = 0; int PrevIter = 0, BaseCount = 0, Count = 0;
for (SimpleLoopReduction::iterator J = PossibleReds[i].begin(), for (Instruction *J : PossibleReds[i]) {
JE = PossibleReds[i].end(); J != JE; ++J) { // Note that all instructions in the chain must have been found because
// Note that all instructions in the chain must have been found because // all instructions in the function must have been assigned to some
// all instructions in the function must have been assigned to some // iteration.
// iteration. int Iter = PossibleRedIter[J];
int Iter = PossibleRedIter[*J];
if (Iter != PrevIter && Iter != PrevIter + 1 && if (Iter != PrevIter && Iter != PrevIter + 1 &&
!PossibleReds[i].getReducedValue()->isAssociative()) { !PossibleReds[i].getReducedValue()->isAssociative()) {
DEBUG(dbgs() << "LRR: Out-of-order non-associative reduction: " << DEBUG(dbgs() << "LRR: Out-of-order non-associative reduction: " <<
*J << "\n"); J << "\n");
return false; return false;
} }