[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 8 16:51:00 PST 2002


Changes in directory llvm/lib/Analysis/DataStructure:

DataStructure.cpp updated: 1.53 -> 1.54

---
Log message:

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.



---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.53 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.54
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.53	Fri Nov  8 16:27:09 2002
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Fri Nov  8 16:49:57 2002
@@ -131,6 +131,16 @@
   // 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;
 





More information about the llvm-commits mailing list