[llvm-commits] [llvm] r71077 - in /llvm/trunk: lib/Transforms/IPO/FunctionAttrs.cpp test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll
Chris Lattner
clattner at apple.com
Fri May 8 10:06:37 PDT 2009
On May 7, 2009, at 10:09 AM, Duncan Sands wrote:
> 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.
Gep should work fine. There is also no need to handle this with
libcallaa, basicaa can handle "call malloc" directly.
-Chris
More information about the llvm-commits
mailing list