[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-commits
Subject:    [llvm] r274297 - CodeGen: Use range-based for in LiveVariables, NFC
From:       "Duncan P. N. Exon Smith via llvm-commits" <llvm-commits () lists ! llvm ! org>
Date:       2016-06-30 23:33:35
Message-ID: 20160630233335.70B312A6C037 () llvm ! org
[Download RAW message or body]

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


_______________________________________________
llvm-commits mailing list
llvm-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic