diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-09-01 18:13:40 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-09-01 18:13:40 +0000 |
| commit | 3f7b3d149f4307323c3676c13b4243d6aa6628f0 (patch) | |
| tree | 07a6ce8386b8e6dc09ff0ef637d6a810c26a5d20 /llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp | |
| parent | 1145e33bc6508f7a843c77010af08162b556b6a4 (diff) | |
| download | bcm5719-llvm-3f7b3d149f4307323c3676c13b4243d6aa6628f0.tar.gz bcm5719-llvm-3f7b3d149f4307323c3676c13b4243d6aa6628f0.zip | |
simpler solution to iterator invalidation "problem" found
by expensive checking.
llvm-svn: 80695
Diffstat (limited to 'llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp')
| -rw-r--r-- | llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp index beb4e6f6ad5..7e9fd300990 100644 --- a/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -143,16 +143,11 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC, // Walk the function body looking for call sites. Sync up the call sites in // CGN with those actually in the function. - + // Get the set of call sites currently in the function. - bool isLast = CGN->empty(); - for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(), N; !isLast;){ - // Take care not to use singular iterators. - N = I + 1; - isLast = N == E; - + for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ){ // If this call site is null, then the function pass deleted the call - // entirely and the WeakVH nulled it out. + // entirely and the WeakVH nulled it out. if (I->first == 0 || // If we've already seen this call site, then the FunctionPass RAUW'd // one call with another, which resulted in two "uses" in the edge @@ -168,13 +163,13 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC, E = CGN->end(); continue; } - + assert(!CallSites.count(I->first) && "Call site occurs in node multiple times"); CallSites.insert(std::make_pair(I->first, I->second)); - I = N; + ++I; } - + // Loop over all of the instructions in the function, getting the callsites. for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { |

