summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-07-01 22:34:11 +0000
committerOwen Anderson <resistor@mac.com>2008-07-01 22:34:11 +0000
commit501f207bdf25d2db693e16e5ff306134ab8c3a26 (patch)
tree16e7859874001e74967ce50ab11c4f71b3ba73ac /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent9412c5240adc57e38b46cf2a81029c5b043ccda9 (diff)
downloadbcm5719-llvm-501f207bdf25d2db693e16e5ff306134ab8c3a26.tar.gz
bcm5719-llvm-501f207bdf25d2db693e16e5ff306134ab8c3a26.zip
No need to use std::distance. We can just count the number of operands
much more cheaply. llvm-svn: 52990
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 17a5fa7d846..0a23966f31f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -527,13 +527,16 @@ void SelectionDAG::RemoveDeadNode(SDNode *N, DAGUpdateListener *UpdateListener){
// 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;
OpenPOWER on IntegriCloud