[clang] [llvm] [AMDGPU][clang][CodeGen][opt] Add late-resolved feature identifying predicates (PR #134016)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 18 08:03:53 PDT 2025
================
@@ -9102,6 +9102,15 @@ bool InitializationSequence::Diagnose(Sema &S,
case FK_ConversionFailed: {
QualType FromType = OnlyArg->getType();
+ // __amdgpu_feature_predicate_t can be explicitly cast to the logical op
+ // type, although this is almost always an error and we advise against it
----------------
AaronBallman wrote:
Thank you!
Wouldn't a cleaner design be: use the `__attribute__((target_clones))` attribute on a function declaration and call that function? e.g.,
```
// Original code:
void foo() {
if (__builtin_amdgcn_processor_is("gfx900")) {
do_gfx900_stuff();
}
}
// New code:
__attribute__((target_clones("gfx900")) inline void func() {
do_gfx900_stuff();
}
__attribute__((target_clones("default")) inline void func() {
do_fallback_stuff();
}
void foo() {
func();
}
```
(If you can't tell, I'm still trying to find some way to accomplish what you need but without introducing a novel behavior for a builtin; I'm worried about the usability of the current design because the feature really only works if you hold it just right.)
https://github.com/llvm/llvm-project/pull/134016
More information about the cfe-commits
mailing list