diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-14 06:28:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-14 06:28:00 +0000 |
commit | 8acdca64fd17d57473e7534c085d73af0244e9d8 (patch) | |
tree | 412967a02534f607368b80b15374fde5acfe85d9 /llvm/lib/Analysis/DataStructure/DataStructure.cpp | |
parent | ade85ecf779357b737e4fd1504f263f5f16194a3 (diff) | |
download | bcm5719-llvm-8acdca64fd17d57473e7534c085d73af0244e9d8.tar.gz bcm5719-llvm-8acdca64fd17d57473e7534c085d73af0244e9d8.zip |
- Eliminate provably non-pointer nodes from graphs.
This helps a lot of testcases, for example:
New Time New #Nodes Old Time Old #Nodes
254.gap: 91.1024 21605 91.1397 22657
povray31: 2.7807 8613 3.0152 10338
255.vortex: 1.2034 8153 1.2172 8822
moria: .6756 3150 .7054 3877
300.twolf: .1652 2010 .1851 3270
Typically, testcases which use long and ulong integers a lot get better, f.e. povray above.
llvm-svn: 5566
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructure.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index f2817623d22..6371196c1f7 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp @@ -1039,12 +1039,29 @@ void DSGraph::removeDeadNodes(unsigned Flags) { // Mark all nodes reachable by (non-global) scalar nodes as alive... for (hash_map<Value*, DSNodeHandle>::iterator I = ScalarMap.begin(), - E = ScalarMap.end(); I != E; ++I) - if (!isa<GlobalValue>(I->first)) - I->second.getNode()->markReachableNodes(Alive); - else { // Keep track of global nodes - GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode())); + E = ScalarMap.end(); I != E; ) + if (isa<GlobalValue>(I->first)) { // Keep track of global nodes assert(I->second.getNode() && "Null global node?"); + GlobalNodes.push_back(std::make_pair(I->first, I->second.getNode())); + ++I; + } else { + // Check to see if this is a worthless node generated for non-pointer + // values, such as integers. Consider an addition of long types: A+B. + // Assuming we can track all uses of the value in this context, and it is + // NOT used as a pointer, we can delete the node. We will be able to + // detect this situation if the node pointed to ONLY has Unknown bit set + // in the node. In this case, the node is not incomplete, does not point + // to any other nodes (no mod/ref bits set), and is therefore + // uninteresting for data structure analysis. If we run across one of + // these, prune the scalar pointing to it. + // + DSNode *N = I->second.getNode(); + if (N->NodeType == DSNode::UnknownNode && !isa<Argument>(I->first)) { + ScalarMap.erase(I++); + } else { + I->second.getNode()->markReachableNodes(Alive); + ++I; + } } // The return value is alive as well... |