[llvm-commits] [llvm] r82694 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/VMCore/ test/Analysis/PointerTracking/ test/Transforms/GlobalOpt/ test/Transforms/InstCombine/

Eric Christopher echristo at apple.com
Thu Sep 24 12:51:17 CDT 2009


On Sep 24, 2009, at 10:47 AM, Victor Hernandez wrote:

>  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<Instruction>(ptr_arr));

Not sure if this has been covered, but why not update CreateMalloc in  
the builder interface? This is a bit more unwieldy and moves people  
away from using the builder in as many cases as possible.

-eric



More information about the llvm-commits mailing list