[llvm-commits] [poolalloc] r102346 - /poolalloc/branches/release_26/lib/PoolAllocate/PASimple.cpp
John Criswell
criswell at uiuc.edu
Mon Apr 26 10:32:07 PDT 2010
Author: criswell
Date: Mon Apr 26 12:32:07 2010
New Revision: 102346
URL: http://llvm.org/viewvc/llvm-project?rev=102346&view=rev
Log:
Have the simple pool allocation pass update the DSGraph results when it modifes
an allocation site.
Modified:
poolalloc/branches/release_26/lib/PoolAllocate/PASimple.cpp
Modified: poolalloc/branches/release_26/lib/PoolAllocate/PASimple.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/release_26/lib/PoolAllocate/PASimple.cpp?rev=102346&r1=102345&r2=102346&view=diff
==============================================================================
--- poolalloc/branches/release_26/lib/PoolAllocate/PASimple.cpp (original)
+++ poolalloc/branches/release_26/lib/PoolAllocate/PASimple.cpp Mon Apr 26 12:32:07 2010
@@ -207,9 +207,22 @@
TD.getTypeAllocSize(MI->getAllocatedType()));
}
+ //
+ // Create the pool allocation call.
+ //
Value* args[] = {TheGlobalPool, AllocSize};
Instruction* x = CallInst::Create(PoolAlloc, &args[0], &args[2], MI->getName(), ii);
- ii->replaceAllUsesWith(CastInst::CreatePointerCast(x, ii->getType(), "", ii));
+
+ //
+ // Update the DSGraph.
+ //
+ CombinedDSGraph->getScalarMap().replaceScalar (ii, x);
+
+ //
+ // Replace the old malloc instruction with the call to poolalloc().
+ //
+ x = CastInst::CreatePointerCast(x, ii->getType(), "", ii);
+ ii->replaceAllUsesWith(x);
} else if (CallInst * CI = dyn_cast<CallInst>(ii)) {
CallSite CS(CI);
Function *CF = CS.getCalledFunction();
@@ -252,6 +265,11 @@
Opts + 3,
Name,
InsertPt);
+ //
+ // Update the DSGraph.
+ //
+ CombinedDSGraph->getScalarMap().replaceScalar (CI, V);
+
Instruction *Casted = V;
if (V->getType() != CI->getType())
Casted = CastInst::CreatePointerCast (V, CI->getType(), V->getName(), InsertPt);
@@ -294,6 +312,11 @@
Name,
InsertPt);
+ //
+ // Update the DSGraph.
+ //
+ CombinedDSGraph->getScalarMap().replaceScalar (CI, V);
+
Instruction *Casted = V;
if (V->getType() != CI->getType())
Casted = CastInst::CreatePointerCast (V, CI->getType(), V->getName(), InsertPt);
@@ -327,6 +350,12 @@
Opts + 2,
Name,
InsertPt);
+
+ //
+ // Update the DSGraph.
+ //
+ CombinedDSGraph->getScalarMap().replaceScalar (CI, V);
+
Instruction *Casted = V;
if (V->getType() != CI->getType())
Casted = CastInst::CreatePointerCast (V, CI->getType(), V->getName(), InsertPt);
More information about the llvm-commits
mailing list