r256937 - [Driver] Add support for -fno-builtin-foo options.
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 11 10:18:14 PST 2016
Chad and I talked about this off-list (my fault!) a couple of weeks
ago; finally moving this to an actual review thread.
> On 2016-Jan-06, at 06:35, Chad Rosier via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> Author: mcrosier
> Date: Wed Jan 6 08:35:46 2016
> New Revision: 256937
>
> URL: http://llvm.org/viewvc/llvm-project?rev=256937&view=rev
> Log:
> [Driver] Add support for -fno-builtin-foo options.
>
> Addresses PR4941 and rdar://6756912.
> http://reviews.llvm.org/D15195
>
> Modified:
> cfe/trunk/include/clang/Basic/Builtins.h
> cfe/trunk/include/clang/Basic/LangOptions.h
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/include/clang/Frontend/CodeGenOptions.h
> cfe/trunk/lib/Basic/Builtins.cpp
> cfe/trunk/lib/Basic/LangOptions.cpp
> cfe/trunk/lib/CodeGen/BackendUtil.cpp
> cfe/trunk/lib/CodeGen/CGCall.cpp
> cfe/trunk/lib/CodeGen/CGVTables.cpp
> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> cfe/trunk/lib/CodeGen/CodeGenModule.h
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CodeGenOptions.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/test/CodeGen/2007-04-14-FNoBuiltin.c
> cfe/trunk/test/CodeGen/libcalls-complex.c
> cfe/trunk/test/CodeGen/libcalls-fno-builtin.c
> cfe/trunk/test/CodeGen/nobuiltin.c
> cfe/trunk/test/Sema/implicit-builtin-freestanding.c
>
>
> Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=256937&r1=256936&r2=256937&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
> +++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Jan 6 08:35:46 2016
> @@ -249,6 +249,13 @@ static TargetLibraryInfoImpl *createTLII
> TargetLibraryInfoImpl *TLII = new TargetLibraryInfoImpl(TargetTriple);
> if (!CodeGenOpts.SimplifyLibCalls)
> TLII->disableAllFunctions();
> + else {
> + // Disable individual libc/libm calls in TargetLibraryInfo.
> + LibFunc::Func F;
> + for (auto &FuncName : CodeGenOpts.getNoBuiltinFuncs())
> + if (TLII->getLibFunc(FuncName, F))
> + TLII->setUnavailable(F);
I noticed a difference in LTO with -fno-builtin-FOO, since this code
has no way of running at LTO-time.
Chad wondered if we might be, more generally, conflating the meanings
of -ffreestanding and -fno-builtin. -fno-builtin-FOO doesn't
necessarily block optimizations to a builtin function, it just
designates a particular function as not being a builtin.
I suggest we revert this part of the patch. There's also a follow-up
question: should we stop deleting functions from TLI for (plain)
-fno-builtin?
> + }
>
> switch (CodeGenOpts.getVecLib()) {
> case CodeGenOptions::Accelerate:
More information about the cfe-commits
mailing list