use range-based for loops; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241468 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2015-07-06 16:27:35 +00:00
parent 3d41fcb3da
commit a71390ff3b

View File

@ -509,18 +509,17 @@ MachineTraceMetrics::Ensemble::invalidate(const MachineBasicBlock *BadMBB) {
<< " height.\n"); << " height.\n");
// Find any MBB predecessors that have MBB as their preferred successor. // Find any MBB predecessors that have MBB as their preferred successor.
// They are the only ones that need to be invalidated. // They are the only ones that need to be invalidated.
for (MachineBasicBlock::const_pred_iterator for (const MachineBasicBlock *Pred : MBB->predecessors()) {
I = MBB->pred_begin(), E = MBB->pred_end(); I != E; ++I) { TraceBlockInfo &TBI = BlockInfo[Pred->getNumber()];
TraceBlockInfo &TBI = BlockInfo[(*I)->getNumber()];
if (!TBI.hasValidHeight()) if (!TBI.hasValidHeight())
continue; continue;
if (TBI.Succ == MBB) { if (TBI.Succ == MBB) {
TBI.invalidateHeight(); TBI.invalidateHeight();
WorkList.push_back(*I); WorkList.push_back(Pred);
continue; continue;
} }
// Verify that TBI.Succ is actually a *I successor. // Verify that TBI.Succ is actually a *I successor.
assert((!TBI.Succ || (*I)->isSuccessor(TBI.Succ)) && "CFG changed"); assert((!TBI.Succ || Pred->isSuccessor(TBI.Succ)) && "CFG changed");
} }
} while (!WorkList.empty()); } while (!WorkList.empty());
} }
@ -535,18 +534,17 @@ MachineTraceMetrics::Ensemble::invalidate(const MachineBasicBlock *BadMBB) {
<< " depth.\n"); << " depth.\n");
// Find any MBB successors that have MBB as their preferred predecessor. // Find any MBB successors that have MBB as their preferred predecessor.
// They are the only ones that need to be invalidated. // They are the only ones that need to be invalidated.
for (MachineBasicBlock::const_succ_iterator for (const MachineBasicBlock *Succ : MBB->successors()) {
I = MBB->succ_begin(), E = MBB->succ_end(); I != E; ++I) { TraceBlockInfo &TBI = BlockInfo[Succ->getNumber()];
TraceBlockInfo &TBI = BlockInfo[(*I)->getNumber()];
if (!TBI.hasValidDepth()) if (!TBI.hasValidDepth())
continue; continue;
if (TBI.Pred == MBB) { if (TBI.Pred == MBB) {
TBI.invalidateDepth(); TBI.invalidateDepth();
WorkList.push_back(*I); WorkList.push_back(Succ);
continue; continue;
} }
// Verify that TBI.Pred is actually a *I predecessor. // Verify that TBI.Pred is actually a *I predecessor.
assert((!TBI.Pred || (*I)->isPredecessor(TBI.Pred)) && "CFG changed"); assert((!TBI.Pred || Succ->isPredecessor(TBI.Pred)) && "CFG changed");
} }
} while (!WorkList.empty()); } while (!WorkList.empty());
} }