Convert several loops over MachineFunction basic blocks to range-based loops

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207683 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2014-04-30 18:29:51 +00:00
parent 78ecea93a3
commit 4aef7270c9
7 changed files with 40 additions and 56 deletions
+4 -6
View File
@@ -59,12 +59,11 @@ void LexicalScopes::extractLexicalScopes(
DenseMap<const MachineInstr *, LexicalScope *> &MI2ScopeMap) {
// Scan each instruction and create scopes. First build working set of scopes.
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); I != E;
++I) {
for (const auto &MBB : *MF) {
const MachineInstr *RangeBeginMI = nullptr;
const MachineInstr *PrevMI = nullptr;
DebugLoc PrevDL;
for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end();
for (MachineBasicBlock::const_iterator II = MBB.begin(), IE = MBB.end();
II != IE; ++II) {
const MachineInstr *MInsn = II;
@@ -274,9 +273,8 @@ void LexicalScopes::getMachineBasicBlocks(
return;
if (Scope == CurrentFnLexicalScope) {
for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); I != E;
++I)
MBBs.insert(I);
for (const auto &MBB : *MF)
MBBs.insert(&MBB);
return;
}