[llvm] [DirectX] Set Shader Flag DisableOptimizations. (PR #123136)
S. Bharadwaj Yadavalli via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 08:57:07 PST 2025
bharadwajy wrote:
> Is the `dx.disable_optimizations` metadata documented somewhere? This all looks like it will work, but I don't really understand why we have a custom metadata node coming from the frontend here rather than just looking at `llvm::Attribute::OptimizeNone` on the entry function or something like that.
I am not aware of module-level metadata `dx.disable_optimizations` being documented anywhere nor other module-level metadata presently in use - such as `dx.valver`, `dx.shaderModel`. Created [an issue](#124310) to add documentation.
Currently, presence of command-line option `-Od` is denoted by [adding a module metadata](https://github.com/llvm/llvm-project/blob/7842374103b26933d71a8fe354cd4d8715d55b1c/clang/lib/CodeGen/CGHLSLRuntime.cpp#L189) `dx.disable_optimizations`. I do not know of the context of the design choice, but it seems to be a reasonable choice to capture the module-wide property of optimizations being disabled. Relying on an attribute of a specific function(s) (such as entry) appears to involve additional bookkeeping or traversals and an awkward way to denote a module-wide property.
https://github.com/llvm/llvm-project/pull/123136
More information about the llvm-commits
mailing list