<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Aug 10, 2016, at 9:20 AM, Tim Northover <<a href="mailto:tnorthover@apple.com" class="">tnorthover@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Thanks for the review Quentin.<br class=""><br class=""><blockquote type="cite" class="">On 9 Aug 2016, at 18:10, Quentin Colombet <<a href="mailto:qcolombet@apple.com" class="">qcolombet@apple.com</a>> wrote:<br class="">Shouldn’t we test isNoOpCast or something like that instead?<br class=""><br class="">I.e., having v2i32 becoming v8i8 should also produce a copy.<br class=""></blockquote><br class="">Unfortunately not. bitcasts aren't necessarily nops at this level.</div></div></blockquote><div><br class=""></div><div>Yes, I know, but I thought we had a way to know whether or not they were nops and can use this information instead of checking the equality of the types.</div><div>What I am talking about is:</div><div><span style="color: rgb(37, 53, 85); font-family: Roboto, sans-serif; font-size: 14px; font-weight: bold; background-color: rgb(226, 232, 242);" class="">CastInst::isNoopCast</span></div><div><br class=""></div>I believe it should catch more cases than LLT equality, like on x86 all of then should be noop casts IIRC.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class=""> They're defined to be equivalent to a store/load pair and (for example) big-endian NEON's in-register representation is defined in terms of ld1/st1 instructions, which means that vector bitcasts are REV instructions. See arm64-big-endian-bitconverts.ll for examples.<br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">+    MIRBuilder.buildInstr(TargetOpcode::COPY, getOrCreateVReg(CI),<br class="">+                          getOrCreateVReg(*CI.getOperand(0)));<br class=""></blockquote><br class="">Although this is correct, I’d like to be a little smarter here. Basically, I would like that we directly use CI.getOperand(0)’s vreg if CI hasn’t been created yet. I.e., I’d like we avoid creating copies if we don’t have to.<br class=""></blockquote><br class="">Sounds like a good idea, I'll work on it.<br class=""></div></div></blockquote><div><br class=""></div><div>Thanks!</div><div>The opposite is also true (we could reuse the source if it is available and the def wasn’t set) ;).</div><div><br class=""></div><div>Cheers,</div><div>-Quentin</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Tim.</div></div></blockquote></div><br class=""></body></html>