mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
Make steensgaards performance not shameful
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5524 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1e56c54f41
commit
0f777ab96a
@ -121,6 +121,7 @@ bool Steens::run(Module &M) {
|
|||||||
// Loop over the rest of the module, merging graphs for non-external functions
|
// Loop over the rest of the module, merging graphs for non-external functions
|
||||||
// into this graph.
|
// into this graph.
|
||||||
//
|
//
|
||||||
|
unsigned Count = 0;
|
||||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
|
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
|
||||||
if (!I->isExternal()) {
|
if (!I->isExternal()) {
|
||||||
hash_map<Value*, DSNodeHandle> ValMap;
|
hash_map<Value*, DSNodeHandle> ValMap;
|
||||||
@ -142,6 +143,9 @@ bool Steens::run(Module &M) {
|
|||||||
for (hash_map<Value*, DSNodeHandle>::iterator I = ValMap.begin(),
|
for (hash_map<Value*, DSNodeHandle>::iterator I = ValMap.begin(),
|
||||||
E = ValMap.end(); I != E; ++I)
|
E = ValMap.end(); I != E; ++I)
|
||||||
GVM[I->first].mergeWith(I->second);
|
GVM[I->first].mergeWith(I->second);
|
||||||
|
|
||||||
|
if ((++Count & 1) == 0) // Prune nodes out every other time...
|
||||||
|
ResultGraph->removeTriviallyDeadNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Must recalculate and use the Incomplete markers!!
|
// FIXME: Must recalculate and use the Incomplete markers!!
|
||||||
@ -174,15 +178,17 @@ bool Steens::run(Module &M) {
|
|||||||
ResolveFunctionCall(F, CurCall, RetValMap[F]);
|
ResolveFunctionCall(F, CurCall, RetValMap[F]);
|
||||||
Eliminated = true;
|
Eliminated = true;
|
||||||
}
|
}
|
||||||
if (Eliminated)
|
if (Eliminated) {
|
||||||
CallTargets.erase(CallTargets.begin()+c);
|
CallTargets[c] = CallTargets.back();
|
||||||
else
|
CallTargets.pop_back();
|
||||||
|
} else
|
||||||
++c; // Cannot eliminate this call, skip over it...
|
++c; // Cannot eliminate this call, skip over it...
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CallTargets.empty()) // Eliminated all calls?
|
if (CallTargets.empty()) { // Eliminated all calls?
|
||||||
Calls.erase(Calls.begin()+i); // Remove from call list...
|
CurCall = Calls.back(); // Remove entry
|
||||||
else
|
Calls.pop_back();
|
||||||
|
} else
|
||||||
++i; // Skip this call site...
|
++i; // Skip this call site...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user