[llvm] 9b933e9 - LangRef: getelementptr: inbounds is about the object the pointer is 'based on' (#95650)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 23:51:10 PDT 2024


Author: Ralf Jung
Date: 2024-06-17T08:51:08+02:00
New Revision: 9b933e9c94031287d326a02276e2e09aecb17b57

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

LOG: LangRef: getelementptr: inbounds is about the object the pointer is 'based on' (#95650)

As discussed in
https://discourse.llvm.org/t/getelementptr-inbounds-inbounds-of-which-allocation/79024,
we need the pointer to be inbounds of *the* allocated object the pointer
is based on, not just any allocated object.

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 63d188be2c1ce..492bfd546cf72 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -11390,10 +11390,10 @@ For ``nuw`` (no unsigned wrap):
 For ``inbounds`` all rules of the ``nusw`` attribute apply. Additionally,
 if the ``getelementptr`` has any non-zero indices, the following rules apply:
 
- * The base pointer has an *in bounds* address of an allocated object, which
-   means that it points into an allocated object, or to its end. Note that the
-   object does not have to be live anymore; being in-bounds of a deallocated
-   object is sufficient.
+ * The base pointer has an *in bounds* address of the allocated object that it
+   is :ref:`based <pointeraliasing>` on. This means that it points into that
+   allocated object, or to its end. Note that the object does not have to be
+   live anymore; being in-bounds of a deallocated object is sufficient.
  * During the successive addition of offsets to the address, the resulting
    pointer must remain *in bounds* of the allocated object at each step.
 


        


More information about the llvm-commits mailing list