[llvm-commits] [PATCH] Add malloc call utility functions

Victor Hernandez vhernandez at apple.com
Tue Sep 8 17:35:13 PDT 2009


On Sep 7, 2009, at 3:12 PM, Chris Lattner wrote:

>
> On Sep 5, 2009, at 5:36 AM, Duncan Sands wrote:
>
>> Hi Victor, when bitcode containing a MallocInst is read, it looks
>> like you plan to turn this into a malloc call ignoring the alignment
>> value of the MallocInst.  However if the alignment was huge, the  
>> pointer
>> returned by the malloc call might not be sufficiently aligned.  In  
>> this
>> case you would need to allocate a larger amount of memory and  
>> adjust the
>> returned pointer to be sufficiently aligned.  The extra complexity  
>> may
>> not be worth it: I don't know if anyone ever used huge alignments  
>> with
>> MallocInst, or even if codegen respected these alignments.  If you
>> decide to ignore the alignment I suggest you add a comment about  
>> this.
>
> The MallocInst alignment field is already ignored by all versions of  
> llvm.  Don't worry about this.
>

Exactly.  This is why I ignore MallocInst's alignment field.

Victor




More information about the llvm-commits mailing list