summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA/CallGraph.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-09-19 19:01:06 +0000
committerChris Lattner <sabre@nondot.org>2004-09-19 19:01:06 +0000
commitd6d99dfa3f9beabd4e053ad32e23a191c6a07b2b (patch)
tree29ec82d080f149716d52861a6dba97cd07d9b945 /llvm/lib/Analysis/IPA/CallGraph.cpp
parent855a4ff4dd66b0bc24d89beda9cd390eec011a9c (diff)
downloadbcm5719-llvm-d6d99dfa3f9beabd4e053ad32e23a191c6a07b2b.tar.gz
bcm5719-llvm-d6d99dfa3f9beabd4e053ad32e23a191c6a07b2b.zip
Fix a nasty iterator invalidation problem I introduced yesterday. This
unfortunately is the cause of a bunch of failures from tonight, and the reason the tester is running so slow :( llvm-svn: 16407
Diffstat (limited to 'llvm/lib/Analysis/IPA/CallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/IPA/CallGraph.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraph.cpp b/llvm/lib/Analysis/IPA/CallGraph.cpp
index e3a60248895..dbf5b9f95bd 100644
--- a/llvm/lib/Analysis/IPA/CallGraph.cpp
+++ b/llvm/lib/Analysis/IPA/CallGraph.cpp
@@ -211,10 +211,10 @@ void CallGraphNode::removeCallEdgeTo(CallGraphNode *Callee) {
// the specified callee function. This takes more time to execute than
// removeCallEdgeTo, so it should not be used unless necessary.
void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) {
- for (std::vector<CallGraphNode*>::iterator I = CalledFunctions.begin(),
- E = CalledFunctions.end(); I != E; ++I)
- if (*I == Callee) {
- CalledFunctions.erase(I);
- E = CalledFunctions.end();
+ for (unsigned i = 0, e = CalledFunctions.size(); i != e; ++i)
+ if (CalledFunctions[i] == Callee) {
+ CalledFunctions[i] = CalledFunctions.back();
+ CalledFunctions.pop_back();
+ --i; --e;
}
}
OpenPOWER on IntegriCloud