mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -131,6 +131,16 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset) {
|
|||||||
// Return true immediately if the node is completely folded.
|
// Return true immediately if the node is completely folded.
|
||||||
if (isNodeCompletelyFolded()) return true;
|
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...
|
// Figure out how big the new type we're merging in is...
|
||||||
unsigned NewTySize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0;
|
unsigned NewTySize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user