[PATCH] D128845: [HLSL]Add -O and -Od option for dxc mode.

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 14:45:04 PDT 2022


beanz added inline comments.


================
Comment at: clang/lib/CodeGen/CGHLSLRuntime.cpp:47
+void addDisableOptimizations(llvm::Module &M) {
+  StringRef Key = "dx.disable_optimizations";
+  M.addModuleFlag(llvm::Module::ModFlagBehavior::Override, Key, 1);
----------------
What does this translate to in codegen?


================
Comment at: clang/lib/Driver/ToolChains/HLSL.cpp:170
+      if (OStr == "d") {
+        DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_dxc_opt_disable));
+        DAL->AddFlagArg(nullptr, Opts.getOption(options::OPT_O0));
----------------
Since `dxc_opt_disable` is paired with passing `-O0` do we need the flag at all, or can we just set the module flag if `OptimizationLevel` is 0?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128845



More information about the cfe-commits mailing list