[llvm] e07b899 - [FunctionAttrs] Rename addReadAttrs -> addMemoryAttrs.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 03:49:43 PST 2022


Author: Florian Hahn
Date: 2022-03-11T11:49:22Z
New Revision: e07b8991923b80db6a26d6f89315343c2f88b6e9

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

LOG: [FunctionAttrs] Rename addReadAttrs -> addMemoryAttrs.

The addReadAttrs name is out of date, as the function also adds
the writeonly attribute. addMemoryAttrs is more accurate.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/FunctionAttrs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index e2f1944cee63f..1b9276d42dcdf 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -247,10 +247,10 @@ MemoryAccessKind llvm::computeFunctionBodyMemoryAccess(Function &F,
   return checkFunctionMemoryAccess(F, /*ThisBody=*/true, AAR, {});
 }
 
-/// Deduce readonly/readnone attributes for the SCC.
+/// Deduce readonly/readnone/writeonly attributes for the SCC.
 template <typename AARGetterT>
-static void addReadAttrs(const SCCNodeSet &SCCNodes, AARGetterT &&AARGetter,
-                         SmallSet<Function *, 8> &Changed) {
+static void addMemoryAttrs(const SCCNodeSet &SCCNodes, AARGetterT &&AARGetter,
+                           SmallSet<Function *, 8> &Changed) {
   // Check if any of the functions in the SCC read or write memory.  If they
   // write memory then they can't be marked readnone or readonly.
   bool ReadsMemory = false;
@@ -1810,7 +1810,7 @@ deriveAttrsInPostOrder(ArrayRef<Function *> Functions, AARGetterT &&AARGetter) {
   SmallSet<Function *, 8> Changed;
 
   addArgumentReturnedAttrs(Nodes.SCCNodes, Changed);
-  addReadAttrs(Nodes.SCCNodes, AARGetter, Changed);
+  addMemoryAttrs(Nodes.SCCNodes, AARGetter, Changed);
   addArgumentAttrs(Nodes.SCCNodes, Changed);
   inferConvergent(Nodes.SCCNodes, Changed);
   addNoReturnAttrs(Nodes.SCCNodes, Changed);


        


More information about the llvm-commits mailing list