[llvm] 17beee4 - [LangRef] Clarify that inaccessiblememonly functions are allowed noalias returns

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 18 14:48:01 PST 2022


Author: Philip Reames
Date: 2022-01-18T14:47:46-08:00
New Revision: 17beee44e19ba3d3ccb6a5a4f4429662db7e70c8

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

LOG: [LangRef] Clarify that inaccessiblememonly functions are allowed noalias returns

Confusion over this point came up in a couple of recent changes (D117180, e20b32ff3). Current tone of discussion seems to be that we think inaccessiblememonly was always legal on allocation functions, so this change takes the form of a clarification instead of a change.

Differential Revision: https://reviews.llvm.org/D117571

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e4e5c5d76ec5..bd99e3397bc0 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -1633,9 +1633,15 @@ example:
     on all the hot functions.
 ``inaccessiblememonly``
     This attribute indicates that the function may only access memory that
-    is not accessible by the module being compiled. This is a weaker form
-    of ``readnone``. If the function reads or writes other memory, the
-    behavior is undefined.
+    is not accessible by the module being compiled before return from the
+    function. This is a weaker form of ``readnone``. If the function reads
+    or writes other memory, the behavior is undefined.
+
+    For clarity, note that such functions are allowed to return new memory
+    which is ``noalias`` with respect to memory already accessible from
+    the module.  That is, a function can be both ``inaccessiblememonly`` and
+    have a ``noalias`` return which introduces a new, potentially initialized,
+    allocation.
 ``inaccessiblemem_or_argmemonly``
     This attribute indicates that the function may only access memory that is
     either not accessible by the module being compiled, or is pointed to


        


More information about the llvm-commits mailing list