[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Feb 1 00:24:01 PST 2003
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.79 -> 1.80
---
Log message:
Remove dead nodes more efficiently
---
Diffs of the changes:
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.79 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.80
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.79 Sat Feb 1 00:17:02 2003
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Sat Feb 1 00:23:33 2003
@@ -1095,7 +1095,8 @@
for (unsigned i = 0; i != Nodes.size(); ++i)
if (!Alive.count(Nodes[i])) {
DSNode *N = Nodes[i];
- Nodes.erase(Nodes.begin()+i--); // Erase node from alive list.
+ std::swap(Nodes[i--], Nodes.back()); // move node to end of vector
+ Nodes.pop_back(); // Erase node from alive list.
DeadNodes.push_back(N); // Add node to our list of dead nodes
N->dropAllReferences(); // Drop all outgoing edges
}
More information about the llvm-commits
mailing list