[llvm] [LangRef] Clarify `align` + `noundef` interaction in parameter attributes section (PR #224236)

Ömer Sinan Ağacan via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 02:23:36 PDT 2026


https://github.com/osa1 updated https://github.com/llvm/llvm-project/pull/224236

>From b97d2daaa8624421ececc601bd64e0ffff40e2fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= <omer at osa1.net>
Date: Thu, 17 Sep 2026 10:08:41 +0100
Subject: [PATCH 1/2] [LangRef] Clarify `align` + `noundef` interaction in
 parameter attributes section

---
 llvm/docs/LangRef.md | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/llvm/docs/LangRef.md b/llvm/docs/LangRef.md
index 27e20fde8dc5f..6ae128ff4493a 100644
--- a/llvm/docs/LangRef.md
+++ b/llvm/docs/LangRef.md
@@ -1499,10 +1499,12 @@ Currently, only the following parameter attributes are defined:
     specified alignment. If applied to a vector of pointers, *all* pointers
     (elements) have the specified alignment. If the pointer value does not have
     the specified alignment, {ref}`poison value <poisonvalues>` is returned or
-    passed instead.  The `align` attribute should be combined with the
-    `noundef` attribute to ensure a pointer is aligned, or otherwise the
-    behavior is undefined. Note that `align 1` has no effect on non-byval,
-    non-preallocated arguments.
+    passed instead. If the `align` attribute is combined with the `noundef`
+    attribute, then calling the function with an unaligned value is immediate
+    undefined behavior at the call site, and in the function the value cannot
+    be poison.
+
+    Note that `align 1` has no effect on non-byval, non-preallocated arguments.
 
     Note that this attribute has additional semantics when combined with the
     `byval` or `preallocated` attribute, which are documented there.

>From 4b892801cd4b4369ed277bcc6ccb81ffb7300604 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= <omer at osa1.net>
Date: Thu, 17 Sep 2026 10:23:21 +0100
Subject: [PATCH 2/2] Same clarification in `nonnull` as well

---
 llvm/docs/LangRef.md | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/docs/LangRef.md b/llvm/docs/LangRef.md
index 6ae128ff4493a..6216f265b8320 100644
--- a/llvm/docs/LangRef.md
+++ b/llvm/docs/LangRef.md
@@ -1646,8 +1646,9 @@ Currently, only the following parameter attributes are defined:
     The `nonnull` attribute only refers to the address bits of the pointers.
     If all the address bits are zero, the result will be a poison value, even
     if the pointer has non-zero non-address bits or non-zero external state.
-    The `nonnull` attribute should be combined with the `noundef` attribute
-    to ensure a pointer is not null or otherwise the behavior is undefined.
+    If the `nonnull` attribute is combined with the `noundef` attribute, then
+    calling the function with a null value is immediate undefined behavior at
+    the call site, and in the function the value cannot be poison.
 
 (attr_dereferenceable)=
 



More information about the llvm-commits mailing list