[LLVMdev] interesting possible compiler bug

David Blaikie dblaikie at gmail.com
Mon Oct 15 14:49:31 PDT 2012


On Mon, Oct 15, 2012 at 2:43 PM, Krzysztof Parzyszek
<kparzysz at codeaurora.org> wrote:
> On 10/15/2012 4:39 PM, Eli Friedman wrote:
>>
>>
>> The system malloc isn't, but the compiler can change any given call to
>> malloc to call an implementation which is known to return a non-null
>> pointer.
>
>
> Do we do that in LLVM?  That would be surprising...  Optimizing calls to
> malloc (like memory pooling for example) is not a trivial thing to do, and
> it requires a fairly strong interprocedural analysis.

Why would it require that? If you can see that the malloc doesn't
escape you can, in such simple cases, simply move the data from malloc
memory into an alloca instead.

> The fact that this
> seems to happen with LLVM at -O2 looks more like a bug than a clever
> optimization.
>
>
> -K
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by
> The Linux Foundation
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list