[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

Dale Johannesen dalej at apple.com
Tue Sep 30 16:03:05 PDT 2008


On Sep 30, 2008, at 3:41 PMPDT, Bill Wendling wrote:

> On Tue, Sep 30, 2008 at 3:35 PM, Evan Cheng <evan.cheng at apple.com>  
> wrote:
>> So your take is -fno-builtin stops gcc from recognizing memcpy,  
>> memset
>> as special functions and optimizing them into something else (e.g.
>> bzero). After re-reading the man page entry a few times, I kinda see
>> it. I wish I can find the code in gcc that does this to have higher
>> confidence.
>>
> As Dale mentioned, the GCC text is not ideal. :-) I couldn't find
> anything in the GCC compiler that transformed a memset into a bzero.
> But I could have simply missed something.

I figured it out once a while back; it's convoluted.  IIRC the target- 
independent
code in builtins.c changes bzero to memset, then the target-dependent  
x86
code changes memset back to bzero.  Something like that.  I wrote it  
down in
a radar the last time somebody thought it should be doing something  
different,
but now of course I can't find the radar.

> The correct
> way to handle this option is to convert all memcpy / memset (and
> other) intrinsic calls to normal calls.

That's basically the way gcc distinguishes; it generates different  
nodes (early in the FE IIRC, although I haven't been able to find it)  
depending on whether memset (etc) is to be treated as a builtin or  
not.  I think it's hidden away as a bit in one of those  &*!& tables.




More information about the llvm-commits mailing list