From 13ad5aaaff8a446758b402fd5e9aea22f5bc5682 Mon Sep 17 00:00:00 2001 From: Victor Hernandez Date: Sat, 17 Oct 2009 00:00:19 +0000 Subject: Autoupgrade malloc insts to malloc calls. Update testcases that rely on malloc insts being present. Also prematurely remove MallocInst handling from IndMemRemoval and RaiseAllocations to help pass tests in this incremental step. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84292 91177308-0d34-0410-b5e6-96231b3b80d8 --- examples/BrainF/BrainF.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'examples/BrainF') diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp index 5cf2b883bc..c64b87f2f3 100644 --- a/examples/BrainF/BrainF.cpp +++ b/examples/BrainF/BrainF.cpp @@ -25,6 +25,7 @@ #include "BrainF.h" #include "llvm/Constants.h" +#include "llvm/Instructions.h" #include "llvm/Intrinsics.h" #include "llvm/ADT/STLExtras.h" #include @@ -78,7 +79,11 @@ void BrainF::header(LLVMContext& C) { //%arr = malloc i8, i32 %d ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); - ptr_arr = builder->CreateMalloc(IntegerType::getInt8Ty(C), val_mem, "arr"); + BasicBlock* BB = builder->GetInsertBlock(); + const Type* IntPtrTy = IntegerType::getInt32Ty(C); + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, IntegerType::getInt8Ty(C), + val_mem, NULL, "arr"); + BB->getInstList().push_back(cast(ptr_arr)); //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) { -- cgit v1.2.3