From 07acb3e382967e47005f41cb9aa3bea684ed9da2 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Thu, 30 Jun 2016 23:33:35 +0000 Subject: CodeGen: Use range-based for in LiveVariables, NFC Avoid an implicit iterator to pointer conversion in LiveVariables::runOnBlock by switching to a range-based for. llvm-svn: 274297 --- llvm/lib/CodeGen/LiveVariables.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm/lib/CodeGen/LiveVariables.cpp') diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index e3d854a9ef3..b30d779ad51 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp @@ -575,14 +575,12 @@ void LiveVariables::runOnBlock(MachineBasicBlock *MBB, const unsigned NumRegs) { // Loop over all of the instructions, processing them. DistanceMap.clear(); unsigned Dist = 0; - for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); - I != E; ++I) { - MachineInstr *MI = I; - if (MI->isDebugValue()) + for (MachineInstr &MI : *MBB) { + if (MI.isDebugValue()) continue; - DistanceMap.insert(std::make_pair(MI, Dist++)); + DistanceMap.insert(std::make_pair(&MI, Dist++)); - runOnInstr(MI, Defs); + runOnInstr(&MI, Defs); } // Handle any virtual assignments from PHI nodes which might be at the -- cgit v1.2.3