summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-11-06 21:43:21 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-11-06 21:43:21 +0000
commitce99780980eeb0514c729a50ea17ba720d809703 (patch)
tree2386e84fc8645c8664bc7cb15ebd006737817177 /llvm/lib
parenta70917b2f40309b521b1754231aece7f752a1139 (diff)
downloadbcm5719-llvm-ce99780980eeb0514c729a50ea17ba720d809703.tar.gz
bcm5719-llvm-ce99780980eeb0514c729a50ea17ba720d809703.zip
CallInst::CreateMalloc() and CallInst::CreateFree() need to create calls with correct calling convention
llvm-svn: 86290
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Instructions.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 52d8735d89b..3070241ab5e 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud