Skip to content

Commit 7019302

Browse files
committed
[LangRef] Clarify that the pointer after an objet must be valid.
In some places, we rely on the assumption that the pointer after the object must also be valid and not overflow, but it does not seem to be spelled out clearly in LangRef, unless I missed a reference. The GetElementPtr section mentions that the maximum object size is half the pointer index type space, but then the pointer past the object may wrap. Clarify that the pointer after the object must also be valid. This should match Alive2's semantics: https://alive2.llvm.org/ce/z/Dk8QFL (https://github.com/AliveToolkit/alive2/blob/master/tools/transform.cpp#L1288)
1 parent 72791fe commit 7019302

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/docs/LangRef.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11721,8 +11721,9 @@ As a corollary, the only pointer in bounds of the null pointer in the default
1172111721
address space is the null pointer itself.
1172211722

1172311723
These rules are based on the assumption that no allocated object may cross
11724-
the unsigned address space boundary, and no allocated object may be larger
11725-
than half the pointer index type space.
11724+
the unsigned address space boundary, the pointer after the object must be valid,
11725+
and no allocated object may be larger than half the pointer index type space
11726+
- 1.
1172611727

1172711728
If ``inbounds`` is present on a ``getelementptr`` instruction, the ``nusw``
1172811729
attribute will be automatically set as well. For this reason, the ``nusw``

0 commit comments

Comments
 (0)