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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 06:15:04 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:301
   C linkage.
+- Added support for a nonempty optimization list for MSVC's ``#pragma optimize``.
+  The pragma takes a list of optimizations to turn on or off which applies to
----------------



================
Comment at: clang/include/clang/Sema/Sema.h:761-762
 
+  /// The list of valid optimization parameters passed by \#pragma optimize.
+  std::string MSPragmaOptimizeValidParams;
+  /// The "on" or "off" argument passed by \#pragma optimize, that denotes
----------------
I think we can get rid of this since it's unused now.


================
Comment at: clang/lib/Sema/SemaAttr.cpp:1142
+void Sema::ModifyFnAttributesMSPragmaOptimize(FunctionDecl *FD) {
+  assert(MSPragmaOptimizeValidParams.empty());
+
----------------
I think this should also be removed, as we never assign anything into that variable anyway.


================
Comment at: clang/lib/Sema/SemaAttr.cpp:1144-1149
+  // Don't modify the function attributes if it's "on". "on" resets the
+  // optimizations to the ones listed on the command line
+  if (!MSPragmaOptimizeIsOn) {
+    AddOptnoneAttributeIfNoConflicts(FD, FD->getBeginLoc());
+    return;
+  }
----------------



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