[LLVMdev] Which pass converts call printf to puts?

Christoph Erhardt christoph at sicherha.de
Mon Jun 18 04:31:50 PDT 2012


Hi Thomson,

> Ok. So it seems CI->eraseFromParent() removed the old instruction and
> the new one is inserted right after this one in the inner function in
> the case of printf->puts. There is another line
> CI->repalceAllUsesWith(Result). I think this line could also do the
> replacement besides inserting the new one in the inner function.  What's
> the difference of these 2 replacement methods?
whenever an instruction is replaced, all other instructions that use its
result (as an input operand) have to be told to use the result of the
new instruction instead. That's what CI->replaceAllUsesWith(Result)
does. Only then can the old instruction be removed from the basic block.

Best regards,
Christoph



More information about the llvm-dev mailing list