[clang] [RISCV][FMV] Support target_version (PR #99040)

Philip Reames via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 08:17:44 PDT 2024


================
@@ -11027,13 +11029,27 @@ static bool CheckMultiVersionValue(Sema &S, const FunctionDecl *FD) {
   }
 
   if (TVA) {
-    llvm::SmallVector<StringRef, 8> Feats;
-    TVA->getFeatures(Feats);
-    for (const auto &Feat : Feats) {
-      if (!TargetInfo.validateCpuSupports(Feat)) {
-        S.Diag(FD->getLocation(), diag::err_bad_multiversion_option)
-            << Feature << Feat;
-        return true;
+    if (S.getASTContext().getTargetInfo().getTriple().isRISCV()) {
----------------
preames wrote:

The need to version all of this by target is unfortunate.  Is there a way we can reduce the duplication here?

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


More information about the cfe-commits mailing list