[llvm] r205438 - [C++11, ARM64] Range based for loops in branch relaxation.

Jim Grosbach grosbach at apple.com
Wed Apr 2 11:00:39 PDT 2014


Author: grosbach
Date: Wed Apr  2 13:00:39 2014
New Revision: 205438

URL: http://llvm.org/viewvc/llvm-project?rev=205438&view=rev
Log:
[C++11,ARM64] Range based for loops in branch relaxation.

No functional change intended.

Modified:
    llvm/trunk/lib/Target/ARM64/ARM64BranchRelaxation.cpp

Modified: llvm/trunk/lib/Target/ARM64/ARM64BranchRelaxation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM64/ARM64BranchRelaxation.cpp?rev=205438&r1=205437&r2=205438&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM64/ARM64BranchRelaxation.cpp (original)
+++ llvm/trunk/lib/Target/ARM64/ARM64BranchRelaxation.cpp Wed Apr  2 13:00:39 2014
@@ -120,10 +120,9 @@ void ARM64BranchRelaxation::verify() {
 
 /// print block size and offset information - debugging
 void ARM64BranchRelaxation::dumpBBs() {
-  for (MachineFunction::iterator MBBI = MF->begin(), E = MF->end(); MBBI != E;
-       ++MBBI) {
-    const BasicBlockInfo &BBI = BlockInfo[MBBI->getNumber()];
-    dbgs() << format("BB#%u\toffset=%08x\t", MBBI->getNumber(), BBI.Offset)
+  for (auto &MBB: *MF) {
+    const BasicBlockInfo &BBI = BlockInfo[MBB.getNumber()];
+    dbgs() << format("BB#%u\toffset=%08x\t", MBB.getNumber(), BBI.Offset)
            << format("size=%#x\n", BBI.Size);
   }
 }
@@ -449,8 +448,8 @@ bool ARM64BranchRelaxation::relaxBranchI
   bool Changed = false;
   // Relaxing branches involves creating new basic blocks, so re-eval
   // end() for termination.
-  for (MachineFunction::iterator I = MF->begin(); I != MF->end(); ++I) {
-    MachineInstr *MI = I->getFirstTerminator();
+  for (auto &MBB : *MF) {
+    MachineInstr *MI = MBB.getFirstTerminator();
     if (isConditionalBranch(MI->getOpcode()) &&
         !isBlockInRange(MI, getDestBlock(MI),
                         getBranchDisplacementBits(MI->getOpcode()))) {





More information about the llvm-commits mailing list