[llvm-commits] [poolalloc] r58531 - /poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

John Criswell criswell at uiuc.edu
Fri Oct 31 12:44:53 PDT 2008


Author: criswell
Date: Fri Oct 31 14:44:53 2008
New Revision: 58531

URL: http://llvm.org/viewvc/llvm-project?rev=58531&view=rev
Log:
Modified call site visitor method to ignore calls to NULL function pointers.
Added a global variable to control use of assert() when using bugpoint.

Modified:
    poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp

Modified: poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp?rev=58531&r1=58530&r2=58531&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Fri Oct 31 14:44:53 2008
@@ -29,6 +29,15 @@
 using namespace llvm;
 using namespace PA;
 
+//
+// Flag: UsingBugpoint
+//
+// Description:
+//  There are certain assertions that interfere with bugpoint's ability to
+//  reduce test cases.  When using bugpoint, set this variable to true.
+//
+static bool UsingBugpoint = false;
+
 namespace {
   /// FuncTransform - This class implements transformation required of pool
   /// allocated functions.
@@ -552,6 +561,12 @@
     return;
   }
 
+  // Ignore calls to NULL pointers.
+  if (isa<ConstantPointerNull>(CS.getCalledValue())) {
+    std::cerr << "WARNING: Ignoring call using NULL function pointer.\n";
+    return;
+  }
+
   // If this function is one of the memory manipulating functions built into
   // libc, emulate it with pool calls as appropriate.
   if (CF && CF->isDeclaration()) {
@@ -625,6 +640,7 @@
     if (!CF) {
       DSGraph* dg = Graphs.getDSGraph(*OrigInst->getParent()->getParent());
       DSNode* d = dg->getNodeForValue(OrigInst->getOperand(0)).getNode();
+      assert (d && "No DSNode!\n");
       std::vector<const Function*> g;
       d->addFullFunctionList(g);
       if (g.size()) {
@@ -640,7 +656,13 @@
       }
     }
 
-    assert (CF && "No call graph info");
+    //
+    // Do an assert unless we're bugpointing something.
+    //
+    if (UsingBugpoint)
+      if (!CF) return;
+    else
+      assert (CF && "No call graph info");
 
     // Get the common graph for the set of functions this call may invoke.
     CalleeGraph = Graphs.getDSGraph(*CF);





More information about the llvm-commits mailing list