[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 18 12:33:47 PST 2024
================
@@ -53,3 +53,6 @@ LLVM_FIXED_MD_KIND(MD_DIAssignID, "DIAssignID", 38)
LLVM_FIXED_MD_KIND(MD_coro_outside_frame, "coro.outside.frame", 39)
LLVM_FIXED_MD_KIND(MD_mmra, "mmra", 40)
LLVM_FIXED_MD_KIND(MD_noalias_addrspace, "noalias.addrspace", 41)
+// TODO: this will likelly be placed somewhere else,
+// so we don't mix dxil/hlsl/spirv and clang metadata
+LLVM_FIXED_MD_KIND(MD_dxil_controlflow_hints, "dx.controlflow.hints", 42)
----------------
nikic wrote:
We already have `!unpredictable` and `!prof` metadata serving a fairly similar purpose from an optimization perspective. I'd be concerned about adding another generic metadata that has overlapping purpose -- essentially "flatten" should be treated like `!unpredictable` and "branch" like a strongly predicted `!prof` where we don't know in which direction the prediction is. There was a proposal for `!consistent` metadata (https://discourse.llvm.org/t/rfc-consistent-branches-support-in-llvm/74889) to encode that. At the time there was no consensus to introduce it.
So if you wanted to keep this generic, I'd consider the direction of `!unpredictable` and `!consistent`. But if all you're doing is passing through to the backend, then just doing target-specific metadata is fine (though you really shouldn't be touching any files in IR when doing that).
https://github.com/llvm/llvm-project/pull/116331
More information about the cfe-commits
mailing list