[llvm-commits] [llvm] r56885 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86Subtarget.cpp lib/Target/X86/X86Su

Bill Wendling isanbard at gmail.com
Tue Sep 30 15:22:04 PDT 2008


On Tue, Sep 30, 2008 at 3:17 PM, Evan Cheng <evan.cheng at apple.com> wrote:
>
> On Sep 30, 2008, at 2:52 PM, Bill Wendling wrote:
>
>> On Tue, Sep 30, 2008 at 2:47 PM, Dan Gohman <gohman at apple.com> wrote:
>>>
>>> On Sep 30, 2008, at 2:22 PM, Bill Wendling wrote:
>>>
>>>> Author: void
>>>> Date: Tue Sep 30 16:22:07 2008
>>>> New Revision: 56885
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=56885&view=rev
>>>> Log:
>>>> Add the new `-no-builtin' flag. This flag is meant to mimic the GCC
>>>> `-fno-builtin' flag. Currently, it's used to replace "memset" with
>>>> "_bzero"
>>>> instead of "__bzero" on Darwin10+. This arguably violates the
>>>> meaning of this
>>>> flag, but is currently sufficient. The meaning of this flag should
>>>> become more
>>>> specific over time.
>>>
>>> First, -fno-builtin is only intended to apply to user calls. It is
>>> not
>>> intended to apply to libcalls that the compiler generates. For
>>> example,
>>> specifying -fno-builtin-memcpy does not tell the compiler not to
>>> generate calls to memcpy.
>>>
>>> Second, it looks like there is confusion about the leading
>>> underscores.
>>> The previous code used "__bzero" on Darwin 10, which is actually
>>> printed as "___bzero" because of Darwin ABI rules. By introducing new
>>> code that uses "_bzero", it will be printed as "__bzero" on Darwin,
>>> which doesn't seem to be what was intended here.
>>>
>> That's what was intended.
>>
>>> And furthermore, if "bzero" was intended, meaning printing in the
>>> output as "_bzero" on Darwin, that's an even more flagrant abuse of
>>> the -fno-builtin flag.  -fno-builtin doesn't mean that the compiler
>>> can
>>> call functions with names in the user namespace not reserved by the C
>>> standard.
>>>
>> I would have loved to do that, but people had problems with it.
>
> I am confused by the meaning of -fno-builtin:
>        -fno-builtin
>        -fno-builtin-function
>            Don't recognize built-in functions that do not begin with
>            __builtin_ as prefix.
>
> Does this actually disable the optimization of memset to bzero?
>
That's my reading of it, yes.

-bw



More information about the llvm-commits mailing list