[PATCH] D125723: [MSVC] Add initial support for MSVC pragma optimize

Stephen Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 09:34:22 PDT 2022


steplong added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:304
+  all functions following the pragma. At the moment, only an empty list is
+  supported.
 
----------------
xbolva00 wrote:
> xbolva00 wrote:
> > So to sum up.. #pragma optimize("", off) disables all optimizations, right?
> > 
> > #pragma optimize("", on) enables all, right? is no op if compiled with -O0?
> > 
> > 
> > Other than this release note, looks like there is no way to specifiy own documentation for pragmas? :/ 
> > 
> > Especially if there are differences between MSVC and current implementation...
> Plus, maybe we should emit a warning if #pragma optimize("", on)  is used with -O0?
Hmm, MSVC says `When you use the on parameter, it resets the optimizations to the ones that you specified using the /O compiler option.`, so I don't think we need to emit a warning. I think we differ from MSVC for `off`. For MSVC, `off` turns off frame pointers, "s", and "t". We are just mapping that to optnone.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125723/new/

https://reviews.llvm.org/D125723



More information about the cfe-commits mailing list