[llvm-commits] [poolalloc] r121925 - /poolalloc/trunk/lib/DSA/StdLibPass.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Wed Dec 15 16:01:37 PST 2010


Author: aggarwa4
Date: Wed Dec 15 18:01:37 2010
New Revision: 121925

URL: http://llvm.org/viewvc/llvm-project?rev=121925&view=rev
Log:
Add an option to turn off folding of nodes in 
StdLib. This could allow us to test these changes.

Modified:
    poolalloc/trunk/lib/DSA/StdLibPass.cpp

Modified: poolalloc/trunk/lib/DSA/StdLibPass.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/StdLibPass.cpp?rev=121925&r1=121924&r2=121925&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/StdLibPass.cpp (original)
+++ poolalloc/trunk/lib/DSA/StdLibPass.cpp Wed Dec 15 18:01:37 2010
@@ -29,10 +29,17 @@
 
 static RegisterPass<StdLibDataStructures>
 X("dsa-stdlib", "Standard Library Local Data Structure Analysis");
+STATISTIC(NumNodesFoldedInStdLib,    "Number of nodes folded in std lib");
 
 char StdLibDataStructures::ID;
 
 #define numOps 10
+namespace {
+  static cl::opt<bool> noStdLibFold("dsa-stdlib-no-fold",
+         cl::desc("Don't fold nodes in std-lib."),
+         cl::Hidden,
+         cl::init(false));
+}
 
 //
 // Structure: libAction
@@ -398,13 +405,19 @@
               // Collapse (fold) the DSNode of the return value and the actual
               // arguments if directed to do so.
               //
-              if (recFuncs[x].action.collapse) {
-                if (isa<PointerType>(CI->getType()))
+              if (!noStdLibFold && recFuncs[x].action.collapse) {
+                if (isa<PointerType>(CI->getType())){
                   Graph->getNodeForValue(CI).getNode()->foldNodeCompletely();
-                for (unsigned y = 1; y < CI->getNumOperands(); ++y)
-                  if (isa<PointerType>(CI->getOperand(y)->getType()))
-                    if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
+                  NumNodesFoldedInStdLib++;
+                }
+                for (unsigned y = 1; y < CI->getNumOperands(); ++y){
+                  if (isa<PointerType>(CI->getOperand(y)->getType())){
+                    if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode()){
                       Node->foldNodeCompletely();
+                      NumNodesFoldedInStdLib++;
+                    }
+                  }
+                }
               }
             }
           } else if(ConstantExpr *CE = dyn_cast<ConstantExpr>(ii)) {
@@ -464,13 +477,18 @@
                       // Collapse (fold) the DSNode of the return value and the actual
                       // arguments if directed to do so.
                       //
-                      if (recFuncs[x].action.collapse) {
-                        if (isa<PointerType>(CI->getType()))
+                      if (!noStdLibFold && recFuncs[x].action.collapse) {
+                        if (isa<PointerType>(CI->getType())){
                           Graph->getNodeForValue(CI).getNode()->foldNodeCompletely();
+                          NumNodesFoldedInStdLib++;
+                        }
                         for (unsigned y = 1; y < CI->getNumOperands(); ++y)
-                          if (isa<PointerType>(CI->getOperand(y)->getType()))
-                            if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode())
+                          if (isa<PointerType>(CI->getOperand(y)->getType())){
+                            if (DSNode * Node=Graph->getNodeForValue(CI->getOperand(y)).getNode()){
                               Node->foldNodeCompletely();
+                              NumNodesFoldedInStdLib++;
+                            }
+                          }
                       }
                   }
                 }





More information about the llvm-commits mailing list