[LLVMdev] LLVM Type Int32Ty Problems & LLVMContextImpl.h Problems

Caldarale, Charles R Chuck.Caldarale at unisys.com
Thu Dec 12 12:16:27 PST 2013


> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Jin Huang
> Subject: [LLVMdev] LLVM Type Int32Ty Problems & LLVMContextImpl.h Problems

>    AllocaInst *alloc = new AllocaInst(llvm::Int32Ty, 0, "indexLoc",i);

I think you should be using llvm::Type::getInt32Ty(Context), not llvm::Int32Ty, which is for internal LLVM usage.

Also, using llvm::IRBuilder<> is a whole lot easier and safer than trying to create instruction objects directly.

 - Chuck





More information about the llvm-dev mailing list