From 72cc50852bec44580ee7efe1aa2076273008a6ae Mon Sep 17 00:00:00 2001 From: Roman Divacky Date: Thu, 5 Nov 2009 17:17:44 +0000 Subject: Update LLVM to r86140. --- examples/BrainF/BrainF.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'examples/BrainF/BrainF.cpp') diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp index f17a950036d1..a443ad420ee5 100644 --- a/examples/BrainF/BrainF.cpp +++ b/examples/BrainF/BrainF.cpp @@ -81,8 +81,11 @@ void BrainF::header(LLVMContext& C) { ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal)); BasicBlock* BB = builder->GetInsertBlock(); const Type* IntPtrTy = IntegerType::getInt32Ty(C); - ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, IntegerType::getInt8Ty(C), - val_mem, NULL, "arr"); + const Type* Int8Ty = IntegerType::getInt8Ty(C); + Constant* allocsize = ConstantExpr::getSizeOf(Int8Ty); + allocsize = ConstantExpr::getTruncOrBitCast(allocsize, IntPtrTy); + ptr_arr = CallInst::CreateMalloc(BB, IntPtrTy, Int8Ty, allocsize, 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.3