[llvm-commits] [llvm] r101900 - /llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Dan Gohman gohman at apple.com
Tue Apr 20 07:46:25 PDT 2010


Author: djg
Date: Tue Apr 20 09:46:25 2010
New Revision: 101900

URL: http://llvm.org/viewvc/llvm-project?rev=101900&view=rev
Log:
Don't iterate through the whole block just to find the PHI nodes.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp?rev=101900&r1=101899&r2=101900&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp Tue Apr 20 09:46:25 2010
@@ -211,13 +211,10 @@
 
     // Create Machine PHI nodes for LLVM PHI nodes, lowering them as
     // appropriate.
-    const PHINode *PN;
     DebugLoc DL;
-    for (BasicBlock::const_iterator
-           I = BB->begin(), E = BB->end(); I != E; ++I) {
-
-      PN = dyn_cast<PHINode>(I);
-      if (!PN || PN->use_empty()) continue;
+    for (BasicBlock::const_iterator I = BB->begin();
+         const PHINode *PN = dyn_cast<PHINode>(I); ++I) {
+      if (PN->use_empty()) continue;
 
       unsigned PHIReg = ValueMap[PN];
       assert(PHIReg && "PHI node does not have an assigned virtual register!");





More information about the llvm-commits mailing list