[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Mar 16 21:25:51 PST 2005
Changes in directory llvm/lib/Analysis/DataStructure:
DataStructure.cpp updated: 1.207 -> 1.208
---
Log message:
Do not create ridiculously huge DSNodes, as described in the comments.
This speeds up the BU pass on 172.mgrid from 62.3 -> 0.1242s.
---
Diffs of the changes: (+21 -1)
DataStructure.cpp | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletion(-)
Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.207 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.208
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.207 Wed Mar 16 16:42:19 2005
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Wed Mar 16 23:25:34 2005
@@ -382,13 +382,23 @@
// question....
assert(Offset == 0 && !isArray() &&
"Cannot have an offset into a void node!");
+
+ // If this node would have to have an unreasonable number of fields, just
+ // collapse it. This can occur for fortran common blocks, which have stupid
+ // things like { [100000000 x double], [1000000 x double] }.
+ unsigned NumFields = (NewTySize+DS::PointerSize-1) >> DS::PointerShift;
+ if (NumFields > 64) {
+ foldNodeCompletely();
+ return true;
+ }
+
Ty = NewTy;
NodeType &= ~Array;
if (WillBeArray) NodeType |= Array;
Size = NewTySize;
// Calculate the number of outgoing links from this node.
- Links.resize((Size+DS::PointerSize-1) >> DS::PointerShift);
+ Links.resize(NumFields);
return false;
}
@@ -418,6 +428,16 @@
Ty = NewTy;
NodeType &= ~Array;
if (WillBeArray) NodeType |= Array;
+
+ // If this node would have to have an unreasonable number of fields, just
+ // collapse it. This can occur for fortran common blocks, which have stupid
+ // things like { [100000000 x double], [1000000 x double] }.
+ unsigned NumFields = (NewTySize+DS::PointerSize-1) >> DS::PointerShift;
+ if (NumFields > 64) {
+ foldNodeCompletely();
+ return true;
+ }
+
Size = NewTySize;
// Must grow links to be the appropriate size...
More information about the llvm-commits
mailing list