On Thu, Mar 8, 2012 at 12:51 PM, Chad Rosier <[email protected]> wrote:
> Daniel,
> Currently, -fno-inline is ignored entirely.  This flag is used to ignore the 
> 'inline' keyword, but my understanding is that we don't currently support 
> this keyword anyways.  Someone please speak up if I'm incorrect.
>
> The -fno-inline-functions was previously be ignored, but now it can be used 
> to disable automatic inlining.  Thus, with -fno-inline-functions the only 
> functions that will be inlined are those marked with the always_inline 
> attribute.
>
> Does this clarify things?  Do you see a issues?

Ah, thanks.

No, I think this is the right way to go.

As for -fno-inline, I'm tempted to propose that in Clang we make
-fno-inline a synonym for -fno-inline-functions, as I think this is a
needless source of confusion. However, maybe it is best to ignore it
completely (or reject it).

I find it unfortunate that GCC ruined these flags so that the short
one has the most counterintuitive meaning, but I guess that is really
neither here nor there...

 - Daniel

>
>  Chad
>
>
> On Mar 8, 2012, at 11:19 AM, Daniel Dunbar wrote:
>
>> Hey Chad,
>>
>> I'm having trouble following the patch below. Can you explain exactly
>> what -fno-inline and -fno-inline-functions currently map to?
>>
>> - Daniel
>>
>> On Tue, Mar 6, 2012 at 1:17 PM, Chad Rosier <[email protected]> wrote:
>>> Author: mcrosier
>>> Date: Tue Mar  6 15:17:19 2012
>>> New Revision: 152145
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=152145&view=rev
>>> Log:
>>> [driver] What was implemented in r152130 was actually 
>>> -fno-inline-functions, not
>>> -fno-inline.
>>> Part of rdar://10972766
>>>
>>> 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
>>>    cfe/trunk/test/CodeGen/noinline.c
>>>    cfe/trunk/test/Driver/noinline.c
>>>
>>> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=152145&r1=152144&r2=152145&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
>>> +++ cfe/trunk/include/clang/Driver/CC1Options.td Tue Mar  6 15:17:19 2012
>>> @@ -503,8 +503,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_inline_functions : Flag<"-fno-inline-functions">,
>>> +  HelpText<"Disable automatic 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=152145&r1=152144&r2=152145&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>>> +++ cfe/trunk/include/clang/Driver/Options.td Tue Mar  6 15:17:19 2012
>>> @@ -419,8 +419,8 @@
>>>  def fno_eliminate_unused_debug_symbols : 
>>> Flag<"-fno-eliminate-unused-debug-symbols">, Group<f_Group>;
>>>  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<f_Group>;
>>> +def fno_inline_functions : Flag<"-fno-inline-functions">, Group<f_Group>;
>>> +def fno_inline : Flag<"-fno-inline">, Group<clang_ignored_f_Group>;
>>>  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=152145&r1=152144&r2=152145&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar  6 15:17:19 2012
>>> @@ -2168,8 +2168,8 @@
>>>                    false))
>>>     CmdArgs.push_back("-fgnu89-inline");
>>>
>>> -  if (Args.hasArg(options::OPT_fno_inline))
>>> -    CmdArgs.push_back("-fno-inline");
>>> +  if (Args.hasArg(options::OPT_fno_inline_functions))
>>> +    CmdArgs.push_back("-fno-inline-functions");
>>>
>>>   // -fobjc-nonfragile-abi=0 is default.
>>>   ObjCRuntime objCRuntime;
>>>
>>> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=152145&r1=152144&r2=152145&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
>>> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue Mar  6 15:17:19 2012
>>> @@ -1104,8 +1104,8 @@
>>>   // 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) ?
>>> +  // -fno-inline-functions overrides OptimizationLevel > 1.
>>> +  Opts.Inlining = Args.hasArg(OPT_fno_inline_functions) ?
>>>     CodeGenOptions::OnlyAlwaysInlining : Opts.Inlining;
>>>
>>>   Opts.DebugInfo = Args.hasArg(OPT_g);
>>> @@ -1939,7 +1939,8 @@
>>>   // optimization level and -fno-inline, not actually whether the backend 
>>> has
>>>   // inlining enabled.
>>>   //
>>> -  Opts.NoInline = !Opt || Args.hasArg(OPT_fno_inline);
>>> +  // FIXME: This is affected by other options (-fno-inline).
>>> +  Opts.NoInline = !Opt;
>>>
>>>   Opts.FastMath = Args.hasArg(OPT_ffast_math);
>>>
>>>
>>> Modified: cfe/trunk/test/CodeGen/noinline.c
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/noinline.c?rev=152145&r1=152144&r2=152145&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/CodeGen/noinline.c (original)
>>> +++ cfe/trunk/test/CodeGen/noinline.c Tue Mar  6 15:17:19 2012
>>> @@ -1,7 +1,7 @@
>>> -// Make sure -fno-inline is behaving correctly.
>>> +// Make sure -fno-inline-functions is behaving correctly.
>>>  // rdar://10972766
>>>
>>> -// RUN: %clang_cc1 -O3 -fno-inline -emit-llvm %s -o - | FileCheck 
>>> -check-prefix=NOINLINE %s
>>> +// RUN: %clang_cc1 -O3 -fno-inline-functions -emit-llvm %s -o - | 
>>> FileCheck -check-prefix=NOINLINE %s
>>>
>>>  int dont_inline_me(int a, int b) { return(a+b); }
>>>
>>>
>>> Modified: cfe/trunk/test/Driver/noinline.c
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/noinline.c?rev=152145&r1=152144&r2=152145&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/test/Driver/noinline.c (original)
>>> +++ cfe/trunk/test/Driver/noinline.c Tue Mar  6 15:17:19 2012
>>> @@ -1,9 +1,9 @@
>>> -// Make sure the driver is correctly passing -fno-inline
>>> +// Make sure the driver is correctly passing -fno-inline-functions
>>>  // rdar://10972766
>>>
>>>  // RUN: %clang -target x86_64-apple-darwin10 \
>>> -// RUN:   -fno-inline -### -fsyntax-only %s 2> %t
>>> +// RUN:   -fno-inline-functions -### -fsyntax-only %s 2> %t
>>>  // RUN: FileCheck --check-prefix=CHECK < %t %s
>>>
>>>  // CHECK: clang
>>> -// CHECK: "-fno-inline"
>>> +// CHECK: "-fno-inline-functions"
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> [email protected]
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to