<div dir="ltr">But IRBuilder.CreateXYZ only returns a "VALUE" type. Can I get the instruction created by it? For example,<div><br></div><div>IRBuilder<> builder(&*pinst);</div><div>Value *val = builder.CreateFAdd(LV, RV, "");</div><div><br></div><div>How can I get the fadd instruction created by builder?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 16, 2015 at 8:52 PM, zhi chen <span dir="ltr"><<a href="mailto:zchenhn@gmail.com" target="_blank">zchenhn@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes. That's what I was the solution in my mind. But I just wanted to know if there was a generic way to save some code...</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 16, 2015 at 8:32 PM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>> I understand that I can detect the operation first, and use "create" to<br>
> create for each of them. But I don't if there is a generic way to do this<br>
> because if might be add/sub/mul... operations.<br>
<br>
</span>I don't think there is. Realistically, just blindly replacing<br>
instructions with vector equivalents is only going to work in a few<br>
cases anyway. You're probably best to intentionally detect those cases<br>
and call the correct CreateXYZ function.<br>
<br>
Cheers.<br>
<span><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>