================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to