[llvm-commits] [PATCH] get all MallocInst transforms/analysis to operate on malloc calls instead (patch #1)

Victor Hernandez vhernandez at apple.com
Thu Sep 17 15:21:42 PDT 2009


On Sep 17, 2009, at 1:36 PM, Dan Gohman wrote:

> Hi Victor,
>
> This patch looks good, with one general area of comments:
>
> Instruction.cpp and Verifier.cpp now have their own copy of isMalloc.
> I guess this is to avoid a library dependence, but it's unfortunate.

I agree that it is unfortunate; I did this to avoid adding all of  
MallocHelper into VMCore.  I will add comments explaining that they  
code should match.
>
> The Verifier may move out of VMCore some day, but Instructions.cpp is
> more problematic. It seems that CreateMalloc no longer belongs in
> VMCore; could it be moved? That would avoid at least one of the
> isMalloc copies.

I cannot move CreateMalloc out of VMCore because it will be used by  
Core.cpp's LLVMBuildMalloc and LLVMBuildArrayMalloc.  We agreed that  
it is ok to keep CreateMalloc where it is.
>
> BTW, lib/Analysis currently has an overload of isMalloc which takes
> a non-const Value*. This isn't needed; the const-qualified one will
> always work here.

Thanks.  I got rid of that extra function.

Victor

>
> Dan
>
> On Sep 15, 2009, at 1:38 PM, Victor Hernandez wrote:
>
>> This is the first of 4 patches that will result in malloc calls  
>> having the same transforms/analysis applied to them as are  
>> currently done to MallocInst.
>> This first patch includes changes to the malloc call creation code  
>> (AllocTy is now the element type of the malloc, not the resulting  
>> pointer type) and a bug fix to getMallocArraySize (the case where  
>> the array size is a product of 2 constants was broken).
>> Also included are changes isSafeToSpeculativelyExecute() and  
>> Verifier to treat malloc calls the same as MallocInst.
>>
>> <MallocCalls.diff>
>>
>> Victor
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list