diff options
author | Craig Topper <craig.topper@intel.com> | 2020-08-27 12:32:17 -0700 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2020-08-27 12:54:20 -0700 |
commit | 17ceda99d32035dc654b45ef7af62c571d8a8273 (patch) | |
tree | d2cda09bce5497d48722cf416422987a8ff89b95 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | ff260ad0e014516fbebb4b9f7bcd5e085ac37661 (diff) | |
download | llvm-17ceda99d32035dc654b45ef7af62c571d8a8273.zip llvm-17ceda99d32035dc654b45ef7af62c571d8a8273.tar.gz llvm-17ceda99d32035dc654b45ef7af62c571d8a8273.tar.bz2 |
[CodeGen] Use an AttrBuilder to bulk remove 'target-cpu', 'target-features', and 'tune-cpu' before re-adding in CodeGenModule::setNonAliasAttributes.
I think the removeAttributes interface should be faster than
calling removeAttribute 3 times.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 65e5e27a..77a5079 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1829,9 +1829,11 @@ void CodeGenModule::setNonAliasAttributes(GlobalDecl GD, // We know that GetCPUAndFeaturesAttributes will always have the // newest set, since it has the newest possible FunctionDecl, so the // new ones should replace the old. - F->removeFnAttr("target-cpu"); - F->removeFnAttr("target-features"); - F->removeFnAttr("tune-cpu"); + llvm::AttrBuilder RemoveAttrs; + RemoveAttrs.addAttribute("target-cpu"); + RemoveAttrs.addAttribute("target-features"); + RemoveAttrs.addAttribute("tune-cpu"); + F->removeAttributes(llvm::AttributeList::FunctionIndex, RemoveAttrs); F->addAttributes(llvm::AttributeList::FunctionIndex, Attrs); } } |