Author: Craig Topper Date: 2020-08-27T12:54:20-07:00 New Revision: 17ceda99d32035dc654b45ef7af62c571d8a8273
URL: https://github.com/llvm/llvm-project/commit/17ceda99d32035dc654b45ef7af62c571d8a8273 DIFF: https://github.com/llvm/llvm-project/commit/17ceda99d32035dc654b45ef7af62c571d8a8273.diff LOG: [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. Added: Modified: clang/lib/CodeGen/CodeGenModule.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 65e5e27a5839..77a5079bd0f1 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); } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits