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

Owen Anderson resistor at mac.com
Tue Jul 1 15:34:11 PDT 2008


Author: resistor
Date: Tue Jul  1 17:34:11 2008
New Revision: 52990

URL: http://llvm.org/viewvc/llvm-project?rev=52990&view=rev
Log:
No need to use std::distance.  We can just count the number of operands
much more cheaply.

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52990&r1=52989&r2=52990&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Jul  1 17:34:11 2008
@@ -527,13 +527,16 @@
 
     // Next, brutally remove the operand list.  This is safe to do, as there are
     // no cycles in the graph.
+    unsigned op_num = 0;
     for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) {
       SDNode *Operand = I->getVal();
-      Operand->removeUser(std::distance(N->op_begin(), I), N);
+      Operand->removeUser(op_num, N);
       
       // Now that we removed this operand, see if there are no uses of it left.
       if (Operand->use_empty())
         DeadNodes.push_back(Operand);
+      
+      op_num++;
     }
     if (N->OperandsNeedDelete) {
       delete[] N->OperandList;





More information about the llvm-commits mailing list