[clang] [llvm] [AMDGPU][clang][CodeGen][opt] Add late-resolved feature identifying predicates (PR #134016)

John McCall via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 27 14:02:30 PDT 2025


rjmccall wrote:

Yeah, I agree with the other parts of your design, enabling the builtins within the guarded statements is a great way to handle it.

On a different point: I don't think this builtin is actually semantically different from `__builtin_cpu_is`.  As long as we're not treating it as `constexpr`, the fact that it's lowered by the compiler and doesn't need a runtime check is just a happy property of GPU targeting rather than a fundamental difference. You could certainly imagine targets that *do* simply do this with a runtime switch. And the behavior of allowing additional builtin to be used within the guarded block seems like a nice feature that other targets would probably like to take advantage of.

We could allow `__builtin_processor_is`  as an alternative name for that builtin if folks feel weird about having "cpu" in the name for a GPU target.

https://github.com/llvm/llvm-project/pull/134016


More information about the llvm-commits mailing list