diff options
author | Erich Keane <erich.keane@intel.com> | 2017-10-27 18:32:23 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2017-10-27 18:32:23 +0000 |
commit | cf8807c931fc2e8d6cd44cb38db49611758696f6 (patch) | |
tree | b120ac99e3a383b73962aa3667c8c7f66d793855 /clang/lib/CodeGen/CGCall.cpp | |
parent | bc2b1650d7d59a4d24dccd4eb3992e5cd17acd65 (diff) | |
download | bcm5719-llvm-cf8807c931fc2e8d6cd44cb38db49611758696f6.tar.gz bcm5719-llvm-cf8807c931fc2e8d6cd44cb38db49611758696f6.zip |
Filter out invalid 'target' items from being passed to LLVM
Craig noticed that CodeGen wasn't properly ignoring the
values sent to the target attribute. This patch ignores
them.
This patch also sets the 'default' for this checking to
'supported', since only X86 has implemented the support
for checking valid CPU names and Feature Names.
One test was changed to i686, since it uses a lakemont,
which would otherwise be prohibited in x86_64.
Differential Revision: https://reviews.llvm.org/D39357
llvm-svn: 316783
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index d022c997115..c19fb097f68 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1885,10 +1885,11 @@ void CodeGenModule::ConstructAttributeList( // the function. const auto *TD = FD->getAttr<TargetAttr>(); TargetAttr::ParsedTargetAttr ParsedAttr = TD->parse(); - if (ParsedAttr.Architecture != "") + if (ParsedAttr.Architecture != "" && + getTarget().isValidCPUName(ParsedAttr.Architecture)) TargetCPU = ParsedAttr.Architecture; if (TargetCPU != "") - FuncAttrs.addAttribute("target-cpu", TargetCPU); + FuncAttrs.addAttribute("target-cpu", TargetCPU); if (!Features.empty()) { std::sort(Features.begin(), Features.end()); FuncAttrs.addAttribute( |