diff options
author | Chris Lattner <sabre@nondot.org> | 2005-01-30 23:51:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-01-30 23:51:02 +0000 |
commit | a9548d9fd99beea7d5e4dc6619cb5569b54620c0 (patch) | |
tree | 9f87a41c58c91a4329843364d64c54d788e5171e /lib/Analysis/DataStructure/Steensgaard.cpp | |
parent | 7b2a5270b7613a12fb0b3c12ccdef26367fb8339 (diff) |
* Make some methods more const correct.
* Change the FunctionCalls and AuxFunctionCalls vectors into std::lists.
This makes many operations on these lists much more natural, and avoids
*exteremely* expensive copying of DSCallSites (e.g. moving nodes around
between lists, erasing a node from not the end of the vector, etc).
With a profile build of analyze, this speeds up BU DS from 25.14s to
12.59s on 176.gcc. I expect that it would help TD even more, but I don't
have data for it.
This effectively eliminates removeIdenticalCalls and children from the
profile, going from 6.53 to 0.27s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/Steensgaard.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/Steensgaard.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp index 5102dddec1..eee9b0b6f9 100644 --- a/lib/Analysis/DataStructure/Steensgaard.cpp +++ b/lib/Analysis/DataStructure/Steensgaard.cpp @@ -152,15 +152,15 @@ bool Steens::runOnModule(Module &M) { // Now that we have all of the graphs inlined, we can go about eliminating // call nodes... // - std::vector<DSCallSite> &Calls = - ResultGraph->getAuxFunctionCalls(); + std::list<DSCallSite> &Calls = ResultGraph->getAuxFunctionCalls(); assert(Calls.empty() && "Aux call list is already in use??"); - // Start with a copy of the original call sites... + // Start with a copy of the original call sites. Calls = ResultGraph->getFunctionCalls(); - for (unsigned i = 0; i != Calls.size(); ) { - DSCallSite &CurCall = Calls[i]; + for (std::list<DSCallSite>::iterator CI = Calls.begin(), E = Calls.end(); + CI != E;) { + DSCallSite &CurCall = *CI++; // Loop over the called functions, eliminating as many as possible... std::vector<GlobalValue*> CallTargets; @@ -185,10 +185,9 @@ bool Steens::runOnModule(Module &M) { } if (CallTargets.empty()) { // Eliminated all calls? - CurCall = Calls.back(); // Remove entry - Calls.pop_back(); - } else - ++i; // Skip this call site... + std::list<DSCallSite>::iterator I = CI; + Calls.erase(--I); // Remove entry + } } RetValMap.clear(); |