<font face="verdana,sans-serif">This makes sense now. So if the instruction doesn't make any assignment, it would be unnecessary to replace any operand reference and the same instruction(CI) would be returned from the inner function to avoid this replacement, is this right?<br>
</font><br>Thanks,<div>-Thomson</div><div><br><div class="gmail_quote">On Mon, Jun 18, 2012 at 8:09 PM, Christoph Erhardt <span dir="ltr"><<a href="mailto:christoph@sicherha.de" target="_blank">christoph@sicherha.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Thomson,<br>
<div class="im"><br>
> Could you give an example of the old instruction cannot be removed<br>
> safely? Since the new instruction would produce the same context/result<br>
> of the old one, I suppose it is safe to remove the old one when the new<br>
> instruction is ready (inserted after the old one). Anything I missed here?<br>
</div>yes, you're missing that LLVM programs are in SSA form: A new<br>
instruction always produces a new result.<br>
<br>
Imagine a graph in which every instruction is represented as a node and<br>
every use-relationship is represented as a directed edge. Now if you<br>
want to replace a node with another node, you have to make sure to<br>
properly reconnect all incoming and outgoing edges of the old node,<br>
otherwise they'll be dangling.<br>
<br>
Best regards,<br>
Christoph<br>
</blockquote></div><br>
</div>