From 0d0c5a614a9f0171fbe470ad43ea5657691a6f34 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Wed, 2 Apr 2014 18:00:39 +0000 Subject: [PATCH] [C++11,ARM64] Range based for loops in branch relaxation. No functional change intended. llvm-svn: 205438 --- llvm/lib/Target/ARM64/ARM64BranchRelaxation.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/ARM64/ARM64BranchRelaxation.cpp b/llvm/lib/Target/ARM64/ARM64BranchRelaxation.cpp index f6b36f6..a9bbef5 100644 --- a/llvm/lib/Target/ARM64/ARM64BranchRelaxation.cpp +++ b/llvm/lib/Target/ARM64/ARM64BranchRelaxation.cpp @@ -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::relaxBranchInstructions() { 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()))) { -- 2.7.4