[llvm-commits] [llvm] r86525 - /llvm/trunk/lib/VMCore/Instructions.cpp
Chris Lattner
clattner at apple.com
Tue Nov 10 14:05:54 PST 2009
thanks!
On Nov 10, 2009, at 11:54 AM, Victor Hernandez wrote:
> I just realized that this patch only fixed this for CreateFree(), but
> it also needs to be fixed in CreateMalloc().
> Fixed CreateMalloc() in r86712.
>
> Victor
>
> On Nov 8, 2009, at 11:12 PM, Chris Lattner wrote:
>
>> Author: lattner
>> Date: Mon Nov 9 01:12:01 2009
>> New Revision: 86525
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=86525&view=rev
>> Log:
>> make this handle redefinition of malloc with different prototype
>> correctly.
>>
>> Modified:
>> llvm/trunk/lib/VMCore/Instructions.cpp
>>
>> Modified: llvm/trunk/lib/VMCore/Instructions.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=86525&r1=86524&r2=86525&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/VMCore/Instructions.cpp (original)
>> +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Nov 9 01:12:01 2009
>> @@ -568,8 +568,7 @@
>> const Type *VoidTy = Type::getVoidTy(M->getContext());
>> const Type *IntPtrTy = Type::getInt8PtrTy(M->getContext());
>> // prototype free as "void free(void*)"
>> - Function *FreeFunc = cast<Function>(M->getOrInsertFunction
>> ("free", VoidTy,
>> -
>> IntPtrTy, NULL));
>> + Value *FreeFunc = M->getOrInsertFunction("free", VoidTy,
>> IntPtrTy, NULL);
>> CallInst* Result = NULL;
>> Value *PtrCast = Source;
>> if (InsertBefore) {
>> @@ -582,7 +581,8 @@
>> Result = CallInst::Create(FreeFunc, PtrCast, "");
>> }
>> Result->setTailCall();
>> - Result->setCallingConv(FreeFunc->getCallingConv());
>> + if (Function *F = dyn_cast<Function>(FreeFunc))
>> + Result->setCallingConv(F->getCallingConv());
>>
>> return Result;
>> }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> 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