[llvm-commits] [commit-after-approval] printf("foo %s baz\n", "bar") -> puts("foo bar baz")

Chris Lattner clattner at apple.com
Mon Aug 3 14:32:22 PDT 2009


On Aug 3, 2009, at 1:48 PM, Eli Friedman wrote:

> On Mon, Aug 3, 2009 at 1:22 PM, Mike Stump<mrs at apple.com> wrote:
>> On Aug 3, 2009, at 10:48 AM, Ryan Flynn wrote:
>>> given a printf() call format containing a single "%s" conversion
>>> specifier and a constant string parameter, inlines parameter into
>>> format and lowers printf() to puts().
>>
>> -fno-builtin needs to avoid having this done in general.  Some
>> environments are carefully crafted (-ffreestanding -mkernel) and the
>> transform can break them.
>
> That seems tangential; there are all sorts of transformations in
> SimplifyLibCalls that can break freestanding environments.

Right, simplifylibcalls is libc specific, llvm-gcc and clang shouldn't  
run it in free standing mode.  I'm pretty sure that at least llvm-gcc  
gets this right.

-Chris



More information about the llvm-commits mailing list