[clang] [llvm] [NFC][clang][FMV][TargetInfo] Refactor API for FMV feature priority. (PR #116257)
Piyou Chen via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 14 23:24:30 PST 2024
================
@@ -4216,22 +4216,11 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
llvm::Function *NewFn);
static unsigned
-TargetMVPriority(const TargetInfo &TI,
- const CodeGenFunction::MultiVersionResolverOption &RO) {
- unsigned Priority = 0;
- unsigned NumFeatures = 0;
- for (StringRef Feat : RO.Conditions.Features) {
- Priority = std::max(Priority, TI.multiVersionSortPriority(Feat));
- NumFeatures++;
- }
-
- if (!RO.Conditions.Architecture.empty())
- Priority = std::max(
- Priority, TI.multiVersionSortPriority(RO.Conditions.Architecture));
-
- Priority += TI.multiVersionFeatureCost() * NumFeatures;
-
- return Priority;
+getFMVPriority(const TargetInfo &TI,
+ const CodeGenFunction::MultiVersionResolverOption &RO) {
+ llvm::SmallVector<StringRef, 8> Features{RO.Conditions.Features};
+ Features.push_back(RO.Conditions.Architecture);
+ return TI.getFMVPriority(Features);
----------------
BeMg wrote:
Could it pass the explicit args for `RO.Conditions.Features` and `RO.Conditions.Architecture`?
https://github.com/llvm/llvm-project/pull/116257
More information about the cfe-commits
mailing list