[llvm-commits] [llvm] r71077 - in /llvm/trunk: lib/Transforms/IPO/FunctionAttrs.cpp test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll

Duncan Sands baldrick at free.fr
Thu May 7 10:09:32 PDT 2009


Hi Owen,

> We don't do much in the way of optimization of MallocInst anyways.   
> The only thing that this helps is that it prevents a call to malloc()  
> from clobbering results of a memory dependence query.  As I've  
> advocated on IRC,  I think we should just add  LibCallAA support for  
> saying that malloc() clobbers no known pointers, just like we can use  
> it to say that libm functions only clobber errno.  This seems like the  
> "right" way to go to me.

"malloc" is already marked as returning a "noalias" result IIRC.
Thus there is nothing to be done for malloc: it has already been
done!  MallocInst is different to malloc, and should just be
removed from LLVM.  The only problem I see with this is how to
autoupgrade existing llvm that uses the malloc instruction.  Some
trick (GEP?) will be needed to get the size of the object being
allocated.

Ciao,

Duncan.



More information about the llvm-commits mailing list