[LLVMdev] Which pass converts call printf to puts?

Christoph Erhardt christoph at sicherha.de
Mon Jun 18 05:09:12 PDT 2012


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



More information about the llvm-dev mailing list