summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-11-08 22:49:57 +0000
committerChris Lattner <sabre@nondot.org>2002-11-08 22:49:57 +0000
commitbe46569ba174008631595c12458041e51713d18a (patch)
treed43af04b63a3577081f68626755a8a20a3f9a6a1 /llvm/lib/Analysis/DataStructure/DataStructure.cpp
parente26ec23cbb3611f3b049ebe5ab57d4af264c2087 (diff)
downloadbcm5719-llvm-be46569ba174008631595c12458041e51713d18a.tar.gz
bcm5719-llvm-be46569ba174008631595c12458041e51713d18a.zip
Fold arrays down to a single element. This causes huge wins on some benchmarks
for example: 197.parser (64M->14M), 164.gzip (14M->2.7M). The actual graphs represented should not change at all. llvm-svn: 4643
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--llvm/lib/Analysis/DataStructure/DataStructure.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
index a7653115b8e..3bb10d41844 100644
--- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp
@@ -131,6 +131,16 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) {
// Return true immediately if the node is completely folded.
if (isNodeCompletelyFolded()) return true;
+ // If this is an array type, eliminate the outside arrays because they won't
+ // be used anyway. This greatly reduces the size of large static arrays used
+ // as global variables, for example.
+ //
+ while (const ArrayType *AT = dyn_cast<ArrayType>(NewTy)) {
+ // FIXME: we might want to keep small arrays, but must be careful about
+ // things like: [2 x [10000 x int*]]
+ NewTy = AT->getElementType();
+ }
+
// Figure out how big the new type we're merging in is...
unsigned NewTySize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0;
OpenPOWER on IntegriCloud