From b3020d7a08b951adff8d102b27aaa0bc2a7156da Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Wed, 2 Sep 2009 03:48:41 +0000 Subject: [PATCH] Complicate Chris's simplification, avoiding complaints about singular iterators when building with expensive checks turned on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80757 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/IPA/CallGraphSCCPass.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp index 85f22c7bd42..d21e0316828 100644 --- a/lib/Analysis/IPA/CallGraphSCCPass.cpp +++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp @@ -161,7 +161,7 @@ void CGPassManager::RefreshCallGraph(std::vector &CurSCC, // CGN with those actually in the function. // Get the set of call sites currently in the function. - for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != 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. if (I->first == 0 || @@ -178,7 +178,11 @@ void CGPassManager::RefreshCallGraph(std::vector &CurSCC, "CallGraphSCCPass did not update the CallGraph correctly!"); // Just remove the edge from the set of callees. + bool wasLast = I + 1 == E; CGN->removeCallEdge(I); + if (wasLast) + // I is now a singular iterator, do not compare with E. + break; E = CGN->end(); continue; } -- 2.34.1