[LLVMdev] Which pass converts call printf to puts?
Christoph Erhardt
christoph at sicherha.de
Sun Jun 17 09:54:22 PDT 2012
Hi Thomson,
> I found that LLVM optimized the IR by replacing printf with puts. I
> wondered which pass did this optimization? And is it common that puts
> is faster (and some other metric) than printf?
yes, it's safe to assume that puts() is always faster than printf()
because it doesn't have to perform all the format-string parsing.
Also, the implementation of puts() is a lot smaller - which might matter
if the binary is linked statically and code size is important.
Best regards,
Christoph
More information about the llvm-dev
mailing list