[dragonegg PATCH] Turn off libcall simplification in C and C++ when -fno-builtin is specified

Duncan Sands baldrick at free.fr
Mon Apr 15 01:28:23 PDT 2013


Hi Peter,

> This patch turns off libcall simplification in C and C++ when
> -fno-builtin is specified.
>
> For now I decided to leave the other languages alone, as this is
> probably insufficient for those languages [1].
>
> OK to commit?

I think this patch has several problems.  First off, I'm pretty sure that only
the C-like front-ends define flag_no_builtin, so your patch means that you would
no longer be able to use the plugin for non-C languages as the reference to
flag_no_builtin would fail to resolve when loading the plugin.  Secondly, it
doesn't do the right thing if someone uses -fno-builtin-FUNCTION.

That said, I think something like this is needed, for the following reason.
The -fno-builtin-FUNCTION flags can be supported easily enough because it is
possible to query GCC to find out if the FUNCTION builtin is available (this
doesn't work well for non-C languages because they tend to only set things up
for a sprinkling of builtins they are interested in, not all builtins, but that
can be worked around).  With this implemented, -fno-builtin will automatically
turn off all libcall simplifications for functions that GCC knows about.  But
LLVM has standard library optimizations for functions that GCC doesn't know
about, and this mechanism won't ever be able to turn those off.  The only
solution I see to that is turning off all LLVM libcall simplifications if the
user passes -fno-builtin.  Conclusion: your patch is needed, but you are going
to have to define flag_no_builtin as a weak symbol so that non-C languages
continue to work.

Ciao, Duncan.



More information about the llvm-commits mailing list