summaryrefslogtreecommitdiff
path: root/lib/Analysis/IPA
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-02 04:39:04 +0000
committerChris Lattner <sabre@nondot.org>2009-09-02 04:39:04 +0000
commitd3bd0821b00f1100ab98454264c8775ace826f0d (patch)
tree1eb2f38d2c3af48a8e324b50785c51f482d5b8af /lib/Analysis/IPA
parentb8bcbd61a8a8ea3960da47734579150f514abfbb (diff)
downloadllvm-d3bd0821b00f1100ab98454264c8775ace826f0d.tar.gz
llvm-d3bd0821b00f1100ab98454264c8775ace826f0d.tar.bz2
llvm-d3bd0821b00f1100ab98454264c8775ace826f0d.tar.xz
revert my patch, duncan points out what is wrong with my logic. Add
a comment so that I don't change this in the future :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA')
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index 25964b2cd8..66ccb8a2b7 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -177,12 +177,16 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC,
assert(!CheckingMode &&
"CallGraphSCCPass did not update the CallGraph correctly!");
- // Just remove the edge from the set of callees.
+ // Just remove the edge from the set of callees, keep track of whether
+ // I points to the last element of the vector.
+ bool WasLast = I + 1 == E;
CGN->removeCallEdge(I);
- // If we removed the last edge, get out of the loop.
- if (CGN->empty()) break;
-
+ // If I pointed to the last element of the vector, we have to bail out:
+ // iterator checking rejects comparisons of the resultant pointer with
+ // end.
+ if (WasLast)
+ break;
E = CGN->end();
continue;
}