diff options
author | Victor Hernandez <vhernandez@apple.com> | 2009-11-06 21:43:21 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2009-11-06 21:43:21 +0000 |
commit | e725b7d6aa1d922f7045b072edc1025ef3622bd0 (patch) | |
tree | e88b77e81d4fc9ec9c540c364168769c9578e725 /lib | |
parent | c42f1cb6754214561a0eacb03feea6146ebe6f84 (diff) | |
download | external_llvm-e725b7d6aa1d922f7045b072edc1025ef3622bd0.zip external_llvm-e725b7d6aa1d922f7045b072edc1025ef3622bd0.tar.gz external_llvm-e725b7d6aa1d922f7045b072edc1025ef3622bd0.tar.bz2 |
CallInst::CreateMalloc() and CallInst::CreateFree() need to create calls with correct calling convention
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86290 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 52d8735..3070241 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -524,6 +524,7 @@ static Instruction *createMalloc(Instruction *InsertBefore, } } MCall->setTailCall(); + MCall->setCallingConv(MallocF->getCallingConv()); assert(MCall->getType() != Type::getVoidTy(BB->getContext()) && "Malloc has void return type"); @@ -572,8 +573,8 @@ static Instruction* createFree(Value* Source, Instruction *InsertBefore, const Type *VoidTy = Type::getVoidTy(M->getContext()); const Type *IntPtrTy = Type::getInt8PtrTy(M->getContext()); // prototype free as "void free(void*)" - Constant *FreeFunc = M->getOrInsertFunction("free", VoidTy, IntPtrTy, NULL); - + Function *FreeFunc = cast<Function>(M->getOrInsertFunction("free", VoidTy, + IntPtrTy, NULL)); CallInst* Result = NULL; Value *PtrCast = Source; if (InsertBefore) { @@ -586,6 +587,7 @@ static Instruction* createFree(Value* Source, Instruction *InsertBefore, Result = CallInst::Create(FreeFunc, PtrCast, ""); } Result->setTailCall(); + Result->setCallingConv(FreeFunc->getCallingConv()); return Result; } |