use range-based for loops; NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2015-07-06 16:19:14 +00:00
parent 6fe7acaaf8
commit 98d447c206

View File

@ -998,8 +998,7 @@ computeInstrHeights(const MachineBasicBlock *MBB) {
// MBB is the highest precomputed block in the trace. // MBB is the highest precomputed block in the trace.
if (MBB) { if (MBB) {
TraceBlockInfo &TBI = BlockInfo[MBB->getNumber()]; TraceBlockInfo &TBI = BlockInfo[MBB->getNumber()];
for (unsigned i = 0, e = TBI.LiveIns.size(); i != e; ++i) { for (LiveInReg &LI : TBI.LiveIns) {
LiveInReg LI = TBI.LiveIns[i];
if (TargetRegisterInfo::isVirtualRegister(LI.Reg)) { if (TargetRegisterInfo::isVirtualRegister(LI.Reg)) {
// For virtual registers, the def latency is included. // For virtual registers, the def latency is included.
unsigned &Height = Heights[MTM.MRI->getVRegDef(LI.Reg)]; unsigned &Height = Heights[MTM.MRI->getVRegDef(LI.Reg)];
@ -1209,8 +1208,7 @@ unsigned MachineTraceMetrics::Trace::getResourceLength(
unsigned ResourceIdx) unsigned ResourceIdx)
->unsigned { ->unsigned {
unsigned Cycles = 0; unsigned Cycles = 0;
for (unsigned I = 0; I != Instrs.size(); ++I) { for (const MCSchedClassDesc *SC : Instrs) {
const MCSchedClassDesc *SC = Instrs[I];
if (!SC->isValid()) if (!SC->isValid())
continue; continue;
for (TargetSchedModel::ProcResIter for (TargetSchedModel::ProcResIter
@ -1228,8 +1226,8 @@ unsigned MachineTraceMetrics::Trace::getResourceLength(
for (unsigned K = 0; K != PRDepths.size(); ++K) { for (unsigned K = 0; K != PRDepths.size(); ++K) {
unsigned PRCycles = PRDepths[K] + PRHeights[K]; unsigned PRCycles = PRDepths[K] + PRHeights[K];
for (unsigned I = 0; I != Extrablocks.size(); ++I) for (const MachineBasicBlock *MBB : Extrablocks)
PRCycles += TE.MTM.getProcResourceCycles(Extrablocks[I]->getNumber())[K]; PRCycles += TE.MTM.getProcResourceCycles(MBB->getNumber())[K];
PRCycles += extraCycles(ExtraInstrs, K); PRCycles += extraCycles(ExtraInstrs, K);
PRCycles -= extraCycles(RemoveInstrs, K); PRCycles -= extraCycles(RemoveInstrs, K);
PRMax = std::max(PRMax, PRCycles); PRMax = std::max(PRMax, PRCycles);
@ -1240,8 +1238,8 @@ unsigned MachineTraceMetrics::Trace::getResourceLength(
// Instrs: #instructions in current trace outside current block. // Instrs: #instructions in current trace outside current block.
unsigned Instrs = TBI.InstrDepth + TBI.InstrHeight; unsigned Instrs = TBI.InstrDepth + TBI.InstrHeight;
// Add instruction count from the extra blocks. // Add instruction count from the extra blocks.
for (unsigned i = 0, e = Extrablocks.size(); i != e; ++i) for (const MachineBasicBlock *MBB : Extrablocks)
Instrs += TE.MTM.getResources(Extrablocks[i])->InstrCount; Instrs += TE.MTM.getResources(MBB)->InstrCount;
Instrs += ExtraInstrs.size(); Instrs += ExtraInstrs.size();
Instrs -= RemoveInstrs.size(); Instrs -= RemoveInstrs.size();
if (unsigned IW = TE.MTM.SchedModel.getIssueWidth()) if (unsigned IW = TE.MTM.SchedModel.getIssueWidth())