[llvm] 3524c23 - [SCCP] Use bulk-remove API to bulk-remove attributes. NFCI.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 05:44:49 PDT 2020


Author: Benjamin Kramer
Date: 2020-08-28T14:44:14+02:00
New Revision: 3524c23ff2998bbde467397c4df3bd92d50c1485

URL: https://github.com/llvm/llvm-project/commit/3524c23ff2998bbde467397c4df3bd92d50c1485
DIFF: https://github.com/llvm/llvm-project/commit/3524c23ff2998bbde467397c4df3bd92d50c1485.diff

LOG: [SCCP] Use bulk-remove API to bulk-remove attributes. NFCI.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/SCCP.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 423c4baf262a..57befc9c3cfb 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -1976,18 +1976,18 @@ bool llvm::runIPSCCP(
       // inaccessiblemem_or_argmemonly attributes do not hold any longer. Remove
       // them from both the function and callsites.
       if (ReplacedPointerArg) {
-        SmallVector<Attribute::AttrKind, 2> AttributesToRemove = {
-            Attribute::ArgMemOnly, Attribute::InaccessibleMemOrArgMemOnly};
-        for (auto Attr : AttributesToRemove)
-          F.removeFnAttr(Attr);
+        AttrBuilder AttributesToRemove;
+        AttributesToRemove.addAttribute(Attribute::ArgMemOnly);
+        AttributesToRemove.addAttribute(Attribute::InaccessibleMemOrArgMemOnly);
+        F.removeAttributes(AttributeList::FunctionIndex, AttributesToRemove);
 
         for (User *U : F.users()) {
           auto *CB = dyn_cast<CallBase>(U);
           if (!CB || CB->getCalledFunction() != &F)
             continue;
 
-          for (auto Attr : AttributesToRemove)
-            CB->removeAttribute(AttributeList::FunctionIndex, Attr);
+          CB->removeAttributes(AttributeList::FunctionIndex,
+                               AttributesToRemove);
         }
       }
     }


        


More information about the llvm-commits mailing list