mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-11 11:34:02 +00:00
Do not manipulate invalid iterators. This fixes the
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
This commit is contained in:
parent
72f9ab030e
commit
c142bb294b
@ -145,7 +145,12 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC,
|
|||||||
// CGN with those actually in the function.
|
// 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 (I->first == 0 ||
|
||||||
@ -161,13 +166,13 @@ void CGPassManager::RefreshCallGraph(std::vector<CallGraphNode*> &CurSCC,
|
|||||||
// Just remove the edge from the set of callees.
|
// Just remove the edge from the set of callees.
|
||||||
CGN->removeCallEdge(I);
|
CGN->removeCallEdge(I);
|
||||||
E = CGN->end();
|
E = CGN->end();
|
||||||
--I;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!CallSites.count(I->first) &&
|
assert(!CallSites.count(I->first) &&
|
||||||
"Call site occurs in node multiple times");
|
"Call site occurs in node multiple times");
|
||||||
CallSites.insert(std::make_pair(I->first, I->second));
|
CallSites.insert(std::make_pair(I->first, I->second));
|
||||||
|
I = N;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop over all of the instructions in the function, getting the callsites.
|
// Loop over all of the instructions in the function, getting the callsites.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user