[llvm] r274297 - CodeGen: Use range-based for in LiveVariables, NFC
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 30 16:33:35 PDT 2016
Author: dexonsmith
Date: Thu Jun 30 18:33:35 2016
New Revision: 274297
URL: http://llvm.org/viewvc/llvm-project?rev=274297&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/LiveVariables.cpp
Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=274297&r1=274296&r2=274297&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Thu Jun 30 18:33:35 2016
@@ -575,14 +575,12 @@ void LiveVariables::runOnBlock(MachineBa
// 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
More information about the llvm-commits
mailing list