https://github.com/BeMg created https://github.com/llvm/llvm-project/pull/85899
For RISC-V target only `target_clones` and `target_version` can enable function multiversion(FMV). This patch make target attribute trigger redefinition instead of emit FMV. >From 0bbffb92e7f36957c042cab9a67a483571d9b3f9 Mon Sep 17 00:00:00 2001 From: Piyou Chen <piyou.c...@sifive.com> Date: Mon, 18 Mar 2024 05:07:14 -0700 Subject: [PATCH] [RISCV] Disallow target attribute use in multiversioning --- clang/lib/Sema/SemaDecl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 5850cd0ab6b9aa..e543aff77e67ea 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -11853,6 +11853,10 @@ static bool CheckMultiVersionFunction(Sema &S, FunctionDecl *NewFD, if (NewTA && S.getASTContext().getTargetInfo().getTriple().isAArch64()) return false; + // Target attribute on RISCV is not used for multiversioning + if (NewTA && S.getASTContext().getTargetInfo().getTriple().isRISCV()) + return false; + if (!OldDecl || !OldDecl->getAsFunction() || OldDecl->getDeclContext()->getRedeclContext() != NewFD->getDeclContext()->getRedeclContext()) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits