[llvm-commits] [poolalloc] r120083 - in /poolalloc/trunk/lib/DSA: DataStructure.cpp Local.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Tue Nov 23 20:55:57 PST 2010


Author: aggarwa4
Date: Tue Nov 23 22:55:57 2010
New Revision: 120083

URL: http://llvm.org/viewvc/llvm-project?rev=120083&view=rev
Log:
Minor Formatting.
Allow merging of 2 array nodes, if one is of a
size that is multiple of the other.

Modified:
    poolalloc/trunk/lib/DSA/DataStructure.cpp
    poolalloc/trunk/lib/DSA/Local.cpp

Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=120083&r1=120082&r2=120083&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Tue Nov 23 22:55:57 2010
@@ -410,8 +410,8 @@
     Offset %= getSize();
   }
   const TargetData &TD = getParentGraph()->getTargetData();
-  if (Offset +TD.getTypeAllocSize(NewTy) >= 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);
 
@@ -428,7 +428,7 @@
     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));
+        growSize(Offset + TD.getTypeAllocSize(*ni));
     }
   } else if (TyIt) {
     svset<const Type*> S(*TyMap[Offset]);
@@ -541,7 +541,7 @@
     if(NH.getNode()->getSize() != 0 && CurNodeH.getNode()->getSize() != 0) { 
       if((NH.getNode()->getSize() != CurNodeH.getNode()->getSize() &&
        (NH.getOffset() != 0 || CurNodeH.getOffset() != 0) 
-        && NH.getNode()->getSize() < CurNodeH.getNode()->getSize())) {
+        && NH.getNode()->getSize() <= CurNodeH.getNode()->getSize())) {
         CurNodeH.getNode()->foldNodeCompletely();
         NH.getNode()->foldNodeCompletely();
         NSize = NH.getNode()->getSize();
@@ -565,11 +565,13 @@
   if (CurNodeH.getNode()->isArrayNode() && NH.getNode()->isArrayNode()) {
     if(NH.getNode()->getSize() != 0 && CurNodeH.getNode()->getSize() != 0
        && (NH.getNode()->getSize() != CurNodeH.getNode()->getSize())){
-      CurNodeH.getNode()->foldNodeCompletely();
-      NH.getNode()->foldNodeCompletely();
-      NSize = NH.getNode()->getSize();
-    //  N = NH.getNode();
-      NOffset = NH.getOffset();
+       if(((NH.getNode()->getSize() % CurNodeH.getNode()->getSize()) != 0 ) 
+          && ((CurNodeH.getNode()->getSize() % NH.getNode()->getSize()) != 0)){
+        CurNodeH.getNode()->foldNodeCompletely();
+        NH.getNode()->foldNodeCompletely();
+        NSize = NH.getNode()->getSize();
+        NOffset = NH.getOffset();
+      }
     }
   }
  
@@ -852,8 +854,11 @@
       if (SN->isArrayNode() && DN->isArrayNode()) {
         if((SN->getSize() != DN->getSize()) && (SN->getSize() != 0) 
            && DN->getSize() != 0) {
-           DN->foldNodeCompletely();
-           DN = NH.getNode();
+           if(((SN->getSize() % DN->getSize()) != 0) && 
+              ((DN->getSize() % SN->getSize()) != 0)){
+             DN->foldNodeCompletely();
+             DN = NH.getNode();
+           }
         }
       }
       if (!DN->isNodeCompletelyFolded() && DN->getSize() < SN->getSize())

Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=120083&r1=120082&r2=120083&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Tue Nov 23 22:55:57 2010
@@ -1160,7 +1160,6 @@
   //
   // Do the actual merging in of the constant initializer.
   //
-//  MergeConstantInitIntoNode(NH, ElementType, GV->getInitializer());
   MergeConstantInitIntoNode(NH, GV->getType()->getElementType(), GV->getInitializer());
 
 }





More information about the llvm-commits mailing list