aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-10-17 23:52:26 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-10-17 23:52:26 +0000
commit3fc35c594cbe48070ad69eaa2fdca1e9424c9fd4 (patch)
treef2e8f76264ef8e7298de66b69bc2c3a1381a8ba9 /lib/VMCore/Instructions.cpp
parent391d23b6c29e17b5c969e732169a789ac9d0d422 (diff)
downloadexternal_llvm-3fc35c594cbe48070ad69eaa2fdca1e9424c9fd4.zip
external_llvm-3fc35c594cbe48070ad69eaa2fdca1e9424c9fd4.tar.gz
external_llvm-3fc35c594cbe48070ad69eaa2fdca1e9424c9fd4.tar.bz2
Fix test/Bindings/Ocaml/vmcore.ml. When IRBuilder::CreateMalloc was removed,
LLVMBuildMalloc was reimplemented but with the bug that it didn't insert the resulting instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84374 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index e36da13..e212d5c 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -460,10 +460,10 @@ static Value *checkArraySize(Value *Amt, const Type *IntPtrTy) {
return Amt;
}
-static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd,
- const Type *IntPtrTy, const Type *AllocTy,
- Value *ArraySize, Function* MallocF,
- const Twine &NameStr) {
+static Instruction *createMalloc(Instruction *InsertBefore,
+ BasicBlock *InsertAtEnd, const Type *IntPtrTy,
+ const Type *AllocTy, Value *ArraySize,
+ Function *MallocF, const Twine &NameStr) {
assert(((!InsertBefore && InsertAtEnd) || (InsertBefore && !InsertAtEnd)) &&
"createMalloc needs either InsertBefore or InsertAtEnd");
@@ -507,7 +507,7 @@ static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd,
if (!MallocF->doesNotAlias(0)) MallocF->setDoesNotAlias(0);
const PointerType *AllocPtrType = PointerType::getUnqual(AllocTy);
CallInst *MCall = NULL;
- Value *Result = NULL;
+ Instruction *Result = NULL;
if (InsertBefore) {
MCall = CallInst::Create(MallocF, AllocSize, "malloccall", InsertBefore);
Result = MCall;
@@ -536,9 +536,9 @@ static Value *createMalloc(Instruction *InsertBefore, BasicBlock *InsertAtEnd,
/// constant 1.
/// 2. Call malloc with that argument.
/// 3. Bitcast the result of the malloc call to the specified type.
-Value *CallInst::CreateMalloc(Instruction *InsertBefore, const Type *IntPtrTy,
- const Type *AllocTy, Value *ArraySize,
- const Twine &Name) {
+Instruction *CallInst::CreateMalloc(Instruction *InsertBefore,
+ const Type *IntPtrTy, const Type *AllocTy,
+ Value *ArraySize, const Twine &Name) {
return createMalloc(InsertBefore, NULL, IntPtrTy, AllocTy,
ArraySize, NULL, Name);
}
@@ -551,9 +551,10 @@ Value *CallInst::CreateMalloc(Instruction *InsertBefore, const Type *IntPtrTy,
/// 3. Bitcast the result of the malloc call to the specified type.
/// Note: This function does not add the bitcast to the basic block, that is the
/// responsibility of the caller.
-Value *CallInst::CreateMalloc(BasicBlock *InsertAtEnd, const Type *IntPtrTy,
- const Type *AllocTy, Value *ArraySize,
- Function* MallocF, const Twine &Name) {
+Instruction *CallInst::CreateMalloc(BasicBlock *InsertAtEnd,
+ const Type *IntPtrTy, const Type *AllocTy,
+ Value *ArraySize, Function* MallocF,
+ const Twine &Name) {
return createMalloc(NULL, InsertAtEnd, IntPtrTy, AllocTy,
ArraySize, MallocF, Name);
}