[LLVMdev] malloc() vs. MallocInst

Chris Lattner sabre at nondot.org
Sat Oct 27 10:53:16 PDT 2007


On Sat, 27 Oct 2007, Torvald Riegel wrote:
> I recently looked quite some time for why poolalloc wouldn't transform calls
> to malloc() in my program, until I noticed that it handles calls to malloc()
> (eg, stdlib pass) -- but only transforms MallocInst's.
>
> Is there a general policy on how passes should behave? Should they handle both
> representations, is doing -raiseallocs the preferred way, or do we
> explicitely not want any single policy (ie, are there any hidden problems)?
> Perhaps this could also get a FAQ entry or sth. like that.

Generally passes should assume that they are operating on a canonical form 
of the program if some other pass provides that.  In this case, because 
raiseallocs transforms malloc calls into malloc instructions, it is very 
reasonable for poolalloc to assume everything is using the instruction 
form.

Likewise, DSA and poolalloc will be significantly less precise and useful 
if you run it on a .bc file that has not yet been optimized.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list