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

John Criswell criswell at uiuc.edu
Tue Jul 6 14:26:54 PDT 2010


Author: criswell
Date: Tue Jul  6 16:26:54 2010
New Revision: 107702

URL: http://llvm.org/viewvc/llvm-project?rev=107702&view=rev
Log:
When transforming call sites, ignore those call sites that use an undef value
as the function pointer to call.  This is needed to get poolalloc to work
properly in bugpoint.
This fixes PR#7579.

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=107702&r1=107701&r2=107702&view=diff
==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Tue Jul  6 16:26:54 2010
@@ -654,7 +654,6 @@
 
   const Type* Int32Type = Type::getInt32Ty(CS.getInstruction()->getContext());
 
-
   // If the called function is casted from one function type to another, peer
   // into the cast instruction and pull out the actual function being called.
   if (ConstantExpr *CE = dyn_cast<ConstantExpr>(CS.getCalledValue()))
@@ -667,8 +666,11 @@
     return;
   }
 
-  // Ignore calls to NULL pointers.
-  if (isa<ConstantPointerNull>(CS.getCalledValue())) {
+  //
+  // Ignore calls to NULL pointers or undefined values.
+  //
+  if ((isa<ConstantPointerNull>(CS.getCalledValue())) ||
+      (isa<UndefValue>(CS.getCalledValue()))) {
     errs() << "WARNING: Ignoring call using NULL function pointer.\n";
     return;
   }





More information about the llvm-commits mailing list