<div dir="ltr">Sorry, I mean change <span style="font-size:12.8000001907349px">the scalar instructions to vector ones.</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 16, 2015 at 7:05 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">Thanks, Tim. What I want to do is to change the scalar instructions to scalar ones.<div><br></div><div>For example, if I have to the following one:</div><div><br></div><div>%3 = fadd double %1, double %2</div><div><br></div><div>I want to change it into </div><div>%6 = fadd <2 x double> %4, double %2.</div><div><br></div><div>I understand that I can detect the operation first, and use "create" to create for each of them. But I don't if there is a generic way to do this because if might be add/sub/mul... operations. Clone is not gonna be helpful here because the result type (it is vectortype) should be different to the one being cloned (it is scalar). Any idea about how to do this? Thanks again.</div><div><br></div><div>Best,</div><div>Zhi</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 16, 2015 at 6:16 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>On 16 April 2015 at 17:53, zhi chen <<a href="mailto:zchenhn@gmail.com" target="_blank">zchenhn@gmail.com</a>> wrote:<br>
> Thanks Jonathan. I knew this document. But I didn't understand the "unsigned<br>
> iType, Use *Ops" fields. Could you please help how I can create a new<br>
> instruction to do the example I was giving? Thanks for your time in advance.<br>
<br>
</span>You can't. Instruction's constructor is protected so you can't use it<br>
outside implementing a new Instruction no matter how well you<br>
understood its parameters.<br>
<br>
But, for the record:<br>
  + "it" is to support LLVM's runtime type identification substitutes<br>
(cast<Ty>, dyn_cast<Ty> and isa<Ty> mostly). I don't think the<br>
permitted values are documented in one place, they're mostly an<br>
implementation detail.<br>
  + "Ops" are the operands: in "add %2, %3" they'd be "%2" and "%3"<br>
(or rather, pointers to instances of Value with those names).<br>
<br>
What are you really trying to do  (and why)? It's entirely possible<br>
Instruction::clone isn't what you want, but we can't give better<br>
advice without more details.<br>
<br>
Cheers.<br>
<span><font color="#888888"><br>
Tim.<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>