[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 15:39:57 CDT 2009


On Sep 24, 2009, at 1:07 PM, Chris Lattner wrote:

>
> On Sep 24, 2009, at 10:51 AM, Eric Christopher wrote:
>
>>
>> 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.
>
> Because this isn't going to be a first class part of the IR anymore,  
> we don't need IRBuilder support for it.

Hmm... OK. Just seemed a bit odd that we have a CallInst::CreateMalloc  
but no builder call for it.

-eric



More information about the llvm-commits mailing list