[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 7 15:32:12 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.12 -> 1.13
---
Log message:
Fix a pointer invalidation problem. This fixes Generic/badarg6.ll
---
Diffs of the changes: (+7 -13)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.12 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.13
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.12 Fri Jan 7 16:49:57 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 7 17:32:00 2005
@@ -191,29 +191,22 @@
}
// Next, brutally remove the operand list.
- std::vector<SDNode*> Operands;
while (!N->Operands.empty()) {
- SDOperand O = N->Operands.back();
+ SDNode *O = N->Operands.back().Val;
N->Operands.pop_back();
- Operands.push_back(O.Val);
- O.Val->removeUser(N);
+ O->removeUser(N);
+
+ // Now that we removed this operand, see if there are no uses of it left.
+ DeleteNodeIfDead(O, NodeSet);
}
// Remove the node from the nodes set and delete it.
std::set<SDNode*> &AllNodeSet = *(std::set<SDNode*>*)NodeSet;
AllNodeSet.erase(N);
- delete N;
// Now that the node is gone, check to see if any of the operands of this node
// are dead now.
-
- // Remove duplicate operand entries.
- std::sort(Operands.begin(), Operands.end());
- Operands.erase(std::unique(Operands.begin(), Operands.end()),
- Operands.end());
-
- for (unsigned i = 0, e = Operands.size(); i != e; ++i)
- DeleteNodeIfDead(Operands[i], NodeSet);
+ delete N;
}
@@ -733,6 +726,7 @@
return getNode(ISD::BR, MVT::Other, N1, N3);
else
return N1; // Never-taken branch
+ break;
}
SDNode *N = new SDNode(Opcode, N1, N2, N3);
More information about the llvm-commits
mailing list