[llvm] 5256924 - [LangRef] Clarify semantics of objectsize min parameter (#156309)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 00:52:46 PDT 2025


Author: Nikita Popov
Date: 2025-09-03T09:52:42+02:00
New Revision: 5256924acca8530c311abe64b525ba5dffa02074

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

LOG: [LangRef] Clarify semantics of objectsize min parameter (#156309)

LangRef currently only says that this determines the return value if the
object size if unknown. What it actually does is determine whether the
minimum or maximum size is reported, which degenerates to 0 or -1 if
unknown.

Fixes https://github.com/llvm/llvm-project/issues/156192.

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 2ec1cb51eda89..e64b9343b7622 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -29724,9 +29724,15 @@ Arguments:
 """"""""""
 
 The ``llvm.objectsize`` intrinsic takes four arguments. The first argument is a
-pointer to or into the ``object``. The second argument determines whether
-``llvm.objectsize`` returns 0 (if true) or -1 (if false) when the object size is
-unknown. The third argument controls how ``llvm.objectsize`` acts when ``null``
+pointer to or into the ``object``.
+
+The second argument determines whether ``llvm.objectsize`` returns the minimum
+(if true) or maximum (if false) object size. The minimum size may be any size
+smaller than or equal to the actual object size (including 0 if unknown). The
+maximum size may be any size greater than or equal to the actual object size
+(including -1 if unknown).
+
+The third argument controls how ``llvm.objectsize`` acts when ``null``
 in address space 0 is used as its pointer argument. If it's ``false``,
 ``llvm.objectsize`` reports 0 bytes available when given ``null``. Otherwise, if
 the ``null`` is in a non-zero address space or if ``true`` is given for the


        


More information about the llvm-commits mailing list