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

John Criswell criswell at uiuc.edu
Mon Aug 11 13:41:04 PDT 2008


Author: criswell
Date: Mon Aug 11 15:41:03 2008
New Revision: 54649

URL: http://llvm.org/viewvc/llvm-project?rev=54649&view=rev
Log:
Don't pool allocate calls to realloc() and calloc() if no pool handle can be
found for the DSNode.

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=54649&r1=54648&r2=54649&view=diff

==============================================================================
--- poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp (original)
+++ poolalloc/trunk/lib/PoolAllocate/TransformFunctionBody.cpp Mon Aug 11 15:41:03 2008
@@ -155,6 +155,10 @@
 
   // Insert a call to poolalloc
   Value *PH = getPoolHandle(I);
+
+  // Do not change the instruction into a poolalloc() call unless we have a
+  // real pool descriptor
+  if (PH == 0 || isa<ConstantPointerNull>(PH)) return I;
   
   Value* Opts[2] = {PH, Size};
   Instruction *V = CallInst::Create(PAInfo.PoolAlloc, Opts, Opts + 2, Name, I);
@@ -363,6 +367,9 @@
   Value *OldPtr = CS.getArgument(0);
   Value *Size = CS.getArgument(1);
 
+  // Don't poolallocate if we have no pool handle
+  if (PH == 0 || isa<ConstantPointerNull>(PH)) return;
+
   if (Size->getType() != Type::Int32Ty)
     Size = CastInst::createIntegerCast(Size, Type::Int32Ty, false, Size->getName(), I);
 





More information about the llvm-commits mailing list