<div dir="ltr">I'm not really sure what a NOP even means in SSA. Sure, you can make the assembler and disassembler and interpreter do the right thing, but in any optimisation pass the right thing will be to delete them.<div><br></div><div>If you don't want them to be deleted then, as they have no inputs and no outputs, optimisation could well decide to move other instructions up past a NOP, move it out of loops, etc, until it ends up after the return instruction.</div><div><br></div><div>If you don't want instructions to be moved past it ... it will have to be like a memory barrier instruction, except even stricter.</div><div><br></div><div>What do you want it to do?</div><div><br></div><div>By the way, Apple's B3 optimiser in WebKit (which they wrote to replace LLVM there) does have a NOP instruction -- and an IDENTITY instruction, which also is meaningless in SSA. When an optimisation wants to delete an instruction it turns it into a NOP instead. When an optimisation in LLVM would do a "replace all uses with", B3 inserts an IDENTITY instruction. A later pass deletes all NOPs and propagates inputs of IDENTITYs to their (recursive) users.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 6, 2016 at 10:49 AM, Arno Puder via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi,<br>
<br>
I'm trying to follow the instructions on how to add a new bitcode<br>
instruction:<br>
<a href="http://llvm.org/docs/ExtendingLLVM.html" rel="noreferrer" target="_blank">http://llvm.org/docs/ExtendingLLVM.html</a><br>
<br>
This is my first foray into the guts of LLVM and I'm not sure I'm doing<br>
things the right way. I came up with a patch that adds a NOP (no<br>
operation) that will work with llvm-as, llvm-dis, and lli. It would be<br>
nice if one of the experts could take a look and give some quick feedback:<br>
<a href="https://github.com/apuder/llvm/commit/c58b0c65ac367c8a392a94063afe39b66daa01d4" rel="noreferrer" target="_blank">https://github.com/apuder/llvm/commit/c58b0c65ac367c8a392a94063afe39b66daa01d4</a><br>
<br>
TIA,<br>
Arno<br>
_______________________________________________<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/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>