1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

No need to use std::distance. We can just count the number of operands

much more cheaply.

llvm-svn: 52990
This commit is contained in:
Owen Anderson 2008-07-01 22:34:11 +00:00
parent 0b662363f9
commit b258a71a37

View File

@ -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 // Next, brutally remove the operand list. This is safe to do, as there are
// no cycles in the graph. // no cycles in the graph.
unsigned op_num = 0;
for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) { for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) {
SDNode *Operand = I->getVal(); 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. // Now that we removed this operand, see if there are no uses of it left.
if (Operand->use_empty()) if (Operand->use_empty())
DeadNodes.push_back(Operand); DeadNodes.push_back(Operand);
op_num++;
} }
if (N->OperandsNeedDelete) { if (N->OperandsNeedDelete) {
delete[] N->OperandList; delete[] N->OperandList;