[clang] [llvm] [NFC][clang][FMV][TargetInfo] Refactor API for FMV feature priority. (PR #116257)
Alexandros Lamprineas via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 01:24:08 PST 2024
================
@@ -2938,36 +2914,17 @@ void CodeGenFunction::EmitRISCVMultiVersionResolver(
bool HasDefault = false;
unsigned DefaultIndex = 0;
- SmallVector<CodeGenFunction::MultiVersionResolverOption, 10> CurrOptions(
- Options);
-
- llvm::stable_sort(
- CurrOptions, [](const CodeGenFunction::MultiVersionResolverOption &LHS,
- const CodeGenFunction::MultiVersionResolverOption &RHS) {
- return getPriorityFromAttrString(LHS.Conditions.Features[0]) >
- getPriorityFromAttrString(RHS.Conditions.Features[0]);
- });
-
// Check the each candidate function.
- for (unsigned Index = 0; Index < CurrOptions.size(); Index++) {
+ for (unsigned Index = 0; Index < Options.size(); Index++) {
- if (CurrOptions[Index].Conditions.Features[0].starts_with("default")) {
+ if (Options[Index].Features.empty()) {
HasDefault = true;
DefaultIndex = Index;
continue;
}
Builder.SetInsertPoint(CurBlock);
- std::vector<std::string> TargetAttrFeats =
- getContext()
- .getTargetInfo()
- .parseTargetAttr(CurrOptions[Index].Conditions.Features[0])
----------------
labrinea wrote:
parseTargetAttr expects an unparsed string as I said earlier, but at this point MultiVersionResolverOption already contains parsed strings. I did my best to improve the code but it's already a bit convoluted in my opinion.
https://github.com/llvm/llvm-project/pull/116257
More information about the cfe-commits
mailing list