diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-10 00:14:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-10 00:14:57 +0000 |
commit | df2a78e8332e04eb791d47764d390bd1d20986ed (patch) | |
tree | 47cee731cefb15fba5914aa103292512c0a89631 /llvm | |
parent | 43df2886c5e74e9efdca8d8ed62f2888e44a4ad8 (diff) | |
download | bcm5719-llvm-df2a78e8332e04eb791d47764d390bd1d20986ed.tar.gz bcm5719-llvm-df2a78e8332e04eb791d47764d390bd1d20986ed.zip |
Make steensgaards performance not shameful
llvm-svn: 5524
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/Steensgaard.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp index 5a37791ca12..b17846e2eca 100644 --- a/llvm/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/llvm/lib/Analysis/DataStructure/Steensgaard.cpp @@ -121,6 +121,7 @@ bool Steens::run(Module &M) { // Loop over the rest of the module, merging graphs for non-external functions // into this graph. // + unsigned Count = 0; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (!I->isExternal()) { hash_map<Value*, DSNodeHandle> ValMap; @@ -142,6 +143,9 @@ bool Steens::run(Module &M) { for (hash_map<Value*, DSNodeHandle>::iterator I = ValMap.begin(), E = ValMap.end(); I != E; ++I) 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!! @@ -174,15 +178,17 @@ bool Steens::run(Module &M) { ResolveFunctionCall(F, CurCall, RetValMap[F]); Eliminated = true; } - if (Eliminated) - CallTargets.erase(CallTargets.begin()+c); - else + if (Eliminated) { + CallTargets[c] = CallTargets.back(); + CallTargets.pop_back(); + } else ++c; // Cannot eliminate this call, skip over it... } - if (CallTargets.empty()) // Eliminated all calls? - Calls.erase(Calls.begin()+i); // Remove from call list... - else + if (CallTargets.empty()) { // Eliminated all calls? + CurCall = Calls.back(); // Remove entry + Calls.pop_back(); + } else ++i; // Skip this call site... } |