[cfe-commits] r152130 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Driver/Options.td lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/CodeGen/noinline.c test/Driver/noinline.c
Chad Rosier
mcrosier at apple.com
Tue Mar 6 10:49:20 PST 2012
Author: mcrosier
Date: Tue Mar 6 12:49:20 2012
New Revision: 152130
URL: http://llvm.org/viewvc/llvm-project?rev=152130&view=rev
Log:
[driver] Add support for -fno-inline.
rdar://10972766
Added:
cfe/trunk/test/CodeGen/noinline.c
cfe/trunk/test/Driver/noinline.c
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=152130&r1=152129&r2=152130&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Tue Mar 6 12:49:20 2012
@@ -496,6 +496,8 @@
HelpText<"Allow GNU-extension keywords regardless of language standard">;
def fgnu89_inline : Flag<"-fgnu89-inline">,
HelpText<"Use the gnu89 inline semantics">;
+def fno_inline : Flag<"-fno-inline">,
+ HelpText<"Disable function inlining">;
def fno_gnu_keywords : Flag<"-fno-gnu-keywords">,
HelpText<"Disallow GNU-extension keywords regardless of language standard">;
def fdollars_in_identifiers : Flag<"-fdollars-in-identifiers">,
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=152130&r1=152129&r2=152130&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Tue Mar 6 12:49:20 2012
@@ -412,7 +412,7 @@
def fno_exceptions : Flag<"-fno-exceptions">, Group<f_Group>;
def fno_gnu_keywords : Flag<"-fno-gnu-keywords">, Group<f_Group>;
def fno_inline_functions : Flag<"-fno-inline-functions">, Group<clang_ignored_f_Group>;
-def fno_inline : Flag<"-fno-inline">, Group<clang_ignored_f_Group>;
+def fno_inline : Flag<"-fno-inline">;
def fno_keep_inline_functions : Flag<"-fno-keep-inline-functions">, Group<clang_ignored_f_Group>;
def fno_lax_vector_conversions : Flag<"-fno-lax-vector-conversions">, Group<f_Group>;
def fno_limit_debug_info : Flag<"-fno-limit-debug-info">, Group<f_Group>,
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=152130&r1=152129&r2=152130&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 6 12:49:20 2012
@@ -2138,6 +2138,9 @@
false))
CmdArgs.push_back("-fgnu89-inline");
+ if (Args.hasArg(options::OPT_fno_inline))
+ CmdArgs.push_back("-fno-inline");
+
// -fobjc-nonfragile-abi=0 is default.
ObjCRuntime objCRuntime;
unsigned objcABIVersion = 0;
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=152130&r1=152129&r2=152130&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Mar 6 12:49:20 2012
@@ -1096,6 +1096,9 @@
// We must always run at least the always inlining pass.
Opts.Inlining = (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining
: CodeGenOptions::OnlyAlwaysInlining;
+ // -fno-inline overrides OptimizationLevel > 1.
+ Opts.Inlining = Args.hasArg(OPT_fno_inline) ?
+ CodeGenOptions::OnlyAlwaysInlining : Opts.Inlining;
Opts.DebugInfo = Args.hasArg(OPT_g);
Opts.LimitDebugInfo = !Args.hasArg(OPT_fno_limit_debug_info)
@@ -1915,8 +1918,7 @@
// optimization level and -fno-inline, not actually whether the backend has
// inlining enabled.
//
- // FIXME: This is affected by other options (-fno-inline).
- Opts.NoInline = !Opt;
+ Opts.NoInline = !Opt || Args.hasArg(OPT_fno_inline);
Opts.FastMath = Args.hasArg(OPT_ffast_math);
Added: cfe/trunk/test/CodeGen/noinline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/noinline.c?rev=152130&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/noinline.c (added)
+++ cfe/trunk/test/CodeGen/noinline.c Tue Mar 6 12:49:20 2012
@@ -0,0 +1,14 @@
+// Make sure -fno-inline is behaving correctly.
+// rdar://10972766
+
+// RUN: %clang_cc1 -O3 -fno-inline -emit-llvm %s -o - | FileCheck -check-prefix=NOINLINE %s
+
+int dont_inline_me(int a, int b) { return(a+b); }
+
+volatile int *pa = (int*) 0x1000;
+void foo() {
+// NOINLINE: @foo
+// NOINLINE: dont_inline_me
+ pa[0] = dont_inline_me(pa[1],pa[2]);
+}
+
Added: cfe/trunk/test/Driver/noinline.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/noinline.c?rev=152130&view=auto
==============================================================================
--- cfe/trunk/test/Driver/noinline.c (added)
+++ cfe/trunk/test/Driver/noinline.c Tue Mar 6 12:49:20 2012
@@ -0,0 +1,10 @@
+// Make sure the driver is correctly passing -fno-inline
+// rdar://10972766
+
+// RUN: %clang -target x86_64-apple-darwin10 \
+// RUN: -fno-inline -### -fsyntax-only %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK < %t %s
+
+// CHECK: clang
+// CHECK: "-fno-inline"
+
More information about the cfe-commits
mailing list