[llvm-commits] [poolalloc] r119794 - /poolalloc/trunk/lib/DSA/DataStructure.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Thu Nov 18 23:27:02 PST 2010
Author: aggarwa4
Date: Fri Nov 19 01:27:02 2010
New Revision: 119794
URL: http://llvm.org/viewvc/llvm-project?rev=119794&view=rev
Log:
Update size field correctly.
Modified:
poolalloc/trunk/lib/DSA/DataStructure.cpp
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=119794&r1=119793&r2=119794&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Fri Nov 19 01:27:02 2010
@@ -405,11 +405,11 @@
if (isCollapsedNode()) return;
if (isArrayNode() && getSize() > 0) {
- assert (getSize() && "array node has size of zero!\n");
Offset %= getSize();
}
const TargetData &TD = getParentGraph()->getTargetData();
- if (Offset >= getSize()) growSize(Offset+TD.getTypeAllocSize(NewTy));
+ if (Offset +TD.getTypeAllocSize(NewTy) >= getSize())
+ growSize(Offset+TD.getTypeAllocSize(NewTy));
TyMap[Offset] = getParentGraph()->getTypeSS().getOrCreate(TyMap[Offset], NewTy);
@@ -420,14 +420,19 @@
if (isCollapsedNode()) return;
if (isArrayNode()) Offset %= getSize();
- if (!TyMap[Offset])
+ const TargetData &TD = getParentGraph()->getTargetData();
+ if (!TyMap[Offset]){
TyMap[Offset] = TyIt;
- if (TyIt) {
+ for (svset<const Type*>::const_iterator ni = TyMap[Offset]->begin(),
+ ne = TyMap[Offset]->end(); ni != ne; ++ni) {
+ if (Offset + TD.getTypeAllocSize(*ni) >= getSize())
+ growSize(Offset+TD.getTypeAllocSize(*ni));
+ }
+ } else if (TyIt) {
svset<const Type*> S(*TyMap[Offset]);
S.insert(TyIt->begin(), TyIt->end());
TyMap[Offset] = getParentGraph()->getTypeSS().getOrCreate(S);
}
-
assert(TyMap[Offset]);
}
@@ -727,7 +732,6 @@
DSNode *DN = new DSNode(*SN, Dest, true /* Null out all links */);
DN->maskNodeTypes(BitsToKeep);
NH = DN;
- //DOUT << "getClonedNH: " << SN << " becomes " << DN << "\n";
// Next, recursively clone all outgoing links as necessary. Note that
// adding these links can cause the node to collapse itself at any time, and
More information about the llvm-commits
mailing list