diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp --- a/clang/lib/Basic/Targets/AArch64.cpp +++ b/clang/lib/Basic/Targets/AArch64.cpp @@ -973,12 +973,16 @@ } } for (const auto &Feature : FeaturesVec) - if (Feature[0] == '+') { - std::string F; - llvm::AArch64::getFeatureOption(Feature, F); - UpdatedFeaturesVec.push_back(F); - } else if (Feature[0] != '?') - UpdatedFeaturesVec.push_back(Feature); + if (Feature[0] != '?') { + std::string UpdatedFeature = Feature; + if (Feature[0] == '+') { + std::optional Extension = + llvm::AArch64::parseArchExtension(Feature.substr(1)); + if (Extension) + UpdatedFeature = Extension->Feature.str(); + } + UpdatedFeaturesVec.push_back(UpdatedFeature); + } return TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec); } diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -505,7 +505,6 @@ StringRef resolveCPUAlias(StringRef CPU); // Information by Name -void getFeatureOption(StringRef Name, std::string &Feature); std::optional getArchForCpu(StringRef CPU); // Parser diff --git a/llvm/lib/TargetParser/AArch64TargetParser.cpp b/llvm/lib/TargetParser/AArch64TargetParser.cpp --- a/llvm/lib/TargetParser/AArch64TargetParser.cpp +++ b/llvm/lib/TargetParser/AArch64TargetParser.cpp @@ -25,16 +25,6 @@ return 0; } -void AArch64::getFeatureOption(StringRef Name, std::string &Feature) { - for (const auto &E : llvm::AArch64::Extensions) { - if (Name == E.Name) { - Feature = E.Feature; - return; - } - } - Feature = Name.str(); -} - std::optional AArch64::getArchForCpu(StringRef CPU) { if (CPU == "generic") return ARMV8A;