<div dir="ltr">Thanks! It worked!</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 7, 2018 at 7:35 AM, <a href="http://mayuyu.io">mayuyu.io</a> <span dir="ltr"><<a href="mailto:admin@mayuyu.io" target="_blank">admin@mayuyu.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">By default IRBuilder uses ConstantFolder to fold your constant add instruction. In order to disable this, use IRBuilder<NoFolder> <br>
<br>
Zhang<br>
<div><div class="h5"><br>
> 在 2018年8月7日,10:16,Ahmad Nouralizadeh via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> 写道:<br>
> <br>
> I want to create an add instruction that takes two constant operands at the LLVM IR level. I use the IRBuilder class, but nothing happens. Here is part of the runOnFunction() method of my function pass:<br>
> ...<br>
> LLVMContext &Context = F.getContext();<br>
> IRBuilder<> builder(&Instruction);<br>
> Value *Lef = ConstantInt::get(Type::<wbr>getInt32Ty(Context), 4);<br>
> Value *Rig = ConstantInt::get(Type::<wbr>getInt32Ty(Context), 5);<br>
> Value *Result = builder.CreateAdd(Lef, Rig);<br>
> ...<br>
> It seems that the problem is with the ConstantInt::get() function. Any idea?<br>
</div></div>> ______________________________<wbr>_________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br>
</blockquote></div><br></div>