[LLVMdev] Which pass converts call printf to puts?

Thomson lilotom at gmail.com
Mon Jun 18 05:18:19 PDT 2012


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?

Thanks,
-Thomson

On Mon, Jun 18, 2012 at 8:09 PM, Christoph Erhardt <christoph at sicherha.de>wrote:

> Hi Thomson,
>
> > Could you give an example of the old instruction cannot be removed
> > safely? Since the new instruction would produce the same context/result
> > of the old one, I suppose it is safe to remove the old one when the new
> > instruction is ready (inserted after the old one). Anything I missed
> here?
> yes, you're missing that LLVM programs are in SSA form: A new
> instruction always produces a new result.
>
> Imagine a graph in which every instruction is represented as a node and
> every use-relationship is represented as a directed edge. Now if you
> want to replace a node with another node, you have to make sure to
> properly reconnect all incoming and outgoing edges of the old node,
> otherwise they'll be dangling.
>
> Best regards,
> Christoph
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120618/7d0d8338/attachment.html>


More information about the llvm-dev mailing list