llvm-gcc build when expensive checking is turned on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80671
91177308-0d34-0410-b5e6-
96231b3b80d8
// Walk the function body looking for call sites. Sync up the call sites in
// CGN with those actually in the function.
// 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.
// Get the set of call sites currently in the function.
- for (CallGraphNode::iterator I = CGN->begin(), E = CGN->end(); I != E; ++I){
+ 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;
+
// If this call site is null, then the function pass deleted the call
// 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
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
// Just remove the edge from the set of callees.
CGN->removeCallEdge(I);
E = CGN->end();
// Just remove the edge from the set of callees.
CGN->removeCallEdge(I);
E = CGN->end();
assert(!CallSites.count(I->first) &&
"Call site occurs in node multiple times");
CallSites.insert(std::make_pair(I->first, I->second));
assert(!CallSites.count(I->first) &&
"Call site occurs in node multiple times");
CallSites.insert(std::make_pair(I->first, I->second));
// 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) {
// 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) {