r229575 - clang-cl: Disable frame pointer elimination at -O0

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 20 10:34:28 PDT 2018


It looks like we don't do anything special if you run clang-cl -O0 or /O0,
but it's not an error. I don't have my computer and can't run a test, but
from the outside, it looks like clang-cl -O0 does generate unoptimized code
without warning about an unrecognized flag, but it doesn't disable FP
elimination. It's also a GCC style flag, and usually if a core option is
accepted, it has the same behavior in both driver modes. I'd be fine
removing this extra handling so long as the driver explicitly tells the
user that /O0 isn't recognized. While we're at it, maybe we should warn
about other unrecognized /O flags.

On Wed, Sep 19, 2018 at 6:10 PM Nico Weber <thakis at chromium.org> wrote:

> The generic O flag handling doesn't support 0 either. Would you be ok with
> removing this?
>
> Does /Od do what you want?
>
> On Wed, Sep 19, 2018 at 4:52 PM Reid Kleckner <reid.kleckner at gmail.com>
> wrote:
>
>> I was probably using it myself, and was surprised that /O0 and -O0 had
>> different behavior, because -O0 will hit the special O0 flag that disables
>> FPO, but /O0 will hit the generic 'O' flag handling.
>>
>> On Wed, Sep 19, 2018 at 7:10 AM Nico Weber <thakis at chromium.org> wrote:
>>
>>> Do you remember why you landed this? cl.exe doesn't support /O0; why
>>> does clang-cl?
>>>
>>> On Tue, Feb 17, 2015 at 5:53 PM Reid Kleckner <reid at kleckner.net> wrote:
>>>
>>>> Author: rnk
>>>> Date: Tue Feb 17 16:40:42 2015
>>>> New Revision: 229575
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=229575&view=rev
>>>> Log:
>>>> clang-cl: Disable frame pointer elimination at -O0
>>>>
>>>> This wasn't kicking in because the _SLASH_O flag didn't match our check
>>>> for OPT_O0. Add an alias that does to keep the logic simple.
>>>>
>>>> Modified:
>>>>     cfe/trunk/include/clang/Driver/CLCompatOptions.td
>>>>
>>>> Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=229575&r1=229574&r2=229575&view=diff
>>>>
>>>> ==============================================================================
>>>> --- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
>>>> +++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Tue Feb 17
>>>> 16:40:42 2015
>>>> @@ -80,6 +80,7 @@ def _SLASH_I : CLJoinedOrSeparate<"I">,
>>>>    Alias<I>;
>>>>  def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,
>>>>    Alias<funsigned_char>;
>>>> +def _SLASH_O0 : CLFlag<"O0">, Alias<O0>;
>>>>  def _SLASH_O : CLJoined<"O">, HelpText<"Optimization level">,
>>>>    MetaVarName<"<n>">, Alias<O>;
>>>>  def _SLASH_Ob0 : CLFlag<"Ob0">, HelpText<"Disable inlining">,
>>>>
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180920/b6538892/attachment.html>


More information about the cfe-commits mailing list