<div dir="ltr">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.</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 19, 2018 at 6:10 PM Nico Weber <<a href="mailto:thakis@chromium.org">thakis@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The generic O flag handling doesn't support 0 either. Would you be ok with removing this?<div><br>Does /Od do what you want?</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 19, 2018 at 4:52 PM Reid Kleckner <<a href="mailto:reid.kleckner@gmail.com" target="_blank">reid.kleckner@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 19, 2018 at 7:10 AM Nico Weber <<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Do you remember why you landed this? cl.exe doesn't support /O0; why does clang-cl?</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Feb 17, 2015 at 5:53 PM Reid Kleckner <<a href="mailto:reid@kleckner.net" target="_blank">reid@kleckner.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rnk<br>
Date: Tue Feb 17 16:40:42 2015<br>
New Revision: 229575<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=229575&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=229575&view=rev</a><br>
Log:<br>
clang-cl: Disable frame pointer elimination at -O0<br>
<br>
This wasn't kicking in because the _SLASH_O flag didn't match our check<br>
for OPT_O0. Add an alias that does to keep the logic simple.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Driver/CLCompatOptions.td<br>
<br>
Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=229575&r1=229574&r2=229575&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=229575&r1=229574&r2=229575&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)<br>
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Tue Feb 17 16:40:42 2015<br>
@@ -80,6 +80,7 @@ def _SLASH_I : CLJoinedOrSeparate<"I">,<br>
   Alias<I>;<br>
 def _SLASH_J : CLFlag<"J">, HelpText<"Make char type unsigned">,<br>
   Alias<funsigned_char>;<br>
+def _SLASH_O0 : CLFlag<"O0">, Alias<O0>;<br>
 def _SLASH_O : CLJoined<"O">, HelpText<"Optimization level">,<br>
   MetaVarName<"<n>">, Alias<O>;<br>
 def _SLASH_Ob0 : CLFlag<"Ob0">, HelpText<"Disable inlining">,<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>