[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:41:15 PDT 2008

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'm less sure about memcpy and memset (and a few specific others). In
freestanding mode (which, among other things, implies -fno-builtin),
GCC still reserves these functions. But bzero should not be assumed to
exist here.

> However, this means we should 1) rename -no-builtin to something like -
> no-builtin-optimization, 2) it should disable all of the optimizations
> for memcpy and memset (and probably) others.
I'm not so keen on renaming the option. It could cause confusion.
Actually, making it a function note (like Devang suggests) should
alleviate this.

I agree with (2). As I mentioned in my check-in message, this should
be done in steps to make sure that we get it correct.


More information about the llvm-commits mailing list