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

Xiang Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 12 14:54:35 PDT 2022


python3kgae marked 2 inline comments as done.
python3kgae 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);
----------------
beanz wrote:
> What does this translate to in codegen?
DisableOptimizations in ShaderFlags.

https://github.com/microsoft/DirectXShaderCompiler/blob/main/lib/DXIL/DxilShaderFlags.cpp#L192



================
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));
----------------
beanz wrote:
> 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?
-O0 and -Od will generate different ShaderFlags in dxc.



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