[PATCH] D113647: [X86] Honor command line features along with cpu_specific attribute
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 10 22:08:07 PST 2021
craig.topper created this revision.
craig.topper added reviewers: andrew.w.kaylor, erichkeane, pengfei.
craig.topper requested review of this revision.
Herald added a project: clang.
If the feature is on the command line we should honor it for all
functions. I don't think we could reliably target a single function
for a less capable processor than what the rest of the program is
compiled for.
Fixes PR52407.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113647
Files:
clang/lib/AST/ASTContext.cpp
Index: clang/lib/AST/ASTContext.cpp
===================================================================
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -11759,6 +11759,9 @@
Target->getCPUSpecificCPUDispatchFeatures(
SD->getCPUName(GD.getMultiVersionIndex())->getName(), FeaturesTmp);
std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
+ Features.insert(Features.begin(),
+ Target->getTargetOpts().FeaturesAsWritten.begin(),
+ Target->getTargetOpts().FeaturesAsWritten.end());
Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, Features);
} else {
FeatureMap = Target->getTargetOpts().FeatureMap;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113647.386419.patch
Type: text/x-patch
Size: 727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211111/3077d8ec/attachment-0001.bin>
More information about the cfe-commits
mailing list