[llvm-commits] [poolalloc] r107713 - in /poolalloc/trunk: lib/DSA/DSTest.cpp test/dsa/local/malloc.ll

Will Dietz wdietz2 at illinois.edu
Tue Jul 6 15:32:45 PDT 2010


Author: wdietz2
Date: Tue Jul  6 17:32:45 2010
New Revision: 107713

URL: http://llvm.org/viewvc/llvm-project?rev=107713&view=rev
Log:
Introduced "check-same-node" option that allows the user to specify a group of values that should have been merged.
Allow both "print-node-for-value" and the new "check-same-node" options to accept comma-separated strings as input for convenience.
Updated the malloc test to make use of "check-same-node"

Modified:
    poolalloc/trunk/lib/DSA/DSTest.cpp
    poolalloc/trunk/test/dsa/local/malloc.ll

Modified: poolalloc/trunk/lib/DSA/DSTest.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSTest.cpp?rev=107713&r1=107712&r2=107713&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSTest.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSTest.cpp Tue Jul  6 17:32:45 2010
@@ -27,11 +27,14 @@
 using namespace llvm;
 
 namespace {
-  //FIXME: being able to separate -print-node-for-value options with commas would be nice...
-  cl::list<std::string> PrintNodesForValues("print-node-for-value", cl::ReallyHidden);
+  cl::list<std::string> PrintNodesForValues("print-node-for-value",
+      cl::CommaSeparated, cl::ReallyHidden);
   cl::opt<bool> OnlyPrintFlags("print-only-flags", cl::ReallyHidden);
   cl::opt<bool> OnlyPrintValues("print-only-values", cl::ReallyHidden);
   cl::opt<bool> OnlyPrintTypes("print-only-types", cl::ReallyHidden);
+  //Test if all mentioned values are in the same node
+  cl::list<std::string> CheckNodesSame("check-same-node",
+      cl::CommaSeparated, cl::ReallyHidden);
 }
 
 /// NodeValue -- represents a particular node in a DSGraph
@@ -316,5 +319,20 @@
     // Print corresponding node
     printNode(O, NV);
   }
+
+  // Verify all nodes listed in "CheckNodesSame" belong to the same node.
+  cl::list<std::string>::iterator CI = CheckNodesSame.begin(),
+                                  CE = CheckNodesSame.end();
+  // If the user specified that a set of values should be in the same node...
+  if (CI != CE) {
+    // Take the first such value as the reference to compare to the others
+    NodeValue NVReference(*CI++,M,this);
+
+    // Iterate through the remaining to verify they're the same node.
+    for(; CI != CE; ++CI) {
+      NodeValue NV(*CI, M, this);
+      assert(NVReference.getNodeH()==NV.getNodeH() && "Nodes don't match!");
+    }
+  }
 }
 

Modified: poolalloc/trunk/test/dsa/local/malloc.ll
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/dsa/local/malloc.ll?rev=107713&r1=107712&r2=107713&view=diff
==============================================================================
--- poolalloc/trunk/test/dsa/local/malloc.ll (original)
+++ poolalloc/trunk/test/dsa/local/malloc.ll Tue Jul  6 17:32:45 2010
@@ -1,9 +1,7 @@
 ;--check that local detects call to malloc properly (marks them heap)
 ;RUN: dsaopt %s -dsa-local -analyze -dstest -print-node-for-value "main:b:0" -print-only-flags | grep "H"
-
-;RUNX: dsaopt %s -dsa-td -analyze -dstest -print-node-for-value "main:c" -print-only-flags -print-node-for-value "main:d" -print-node-for-value "main:b:0" >& /tmp/test.log
 ;--check that local has b pointing to node containing c and d
-;RUN: dsaopt %s -dsa-local -analyze -dstest -print-node-for-value "main:b:0" -print-only-values | grep {^c,d$\\|^d,c$}
+;RUN: dsaopt %s -dsa-local -analyze -dstest -check-same-node=main:b:0,main:c,main:d
 ;--check that td/bu don't mark such nodes as incomplete
 ;RUN: dsaopt %s -dsa-td -analyze -dstest -print-node-for-value "main:c" -print-only-flags | not grep "I"
 ;RUN: dsaopt %s -dsa-bu -analyze -dstest -print-node-for-value "main:c" -print-only-flags | not grep "I"





More information about the llvm-commits mailing list