[llvm] [LangRef] Clarify semantics of objectsize min parameter (PR #156309)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 1 03:42:22 PDT 2025
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/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.
>From c092b00e58b40d77c125997488c903560d6aee41 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Mon, 1 Sep 2025 12:39:23 +0200
Subject: [PATCH] [LangRef] Clarify semantics of objectsize min parameter
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.
---
llvm/docs/LangRef.rst | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index b122fd352eaf5..941a7bea6cffe 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -29557,9 +29557,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