[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:12:54 PDT 2026
https://github.com/osa1 created https://github.com/llvm/llvm-project/pull/224236
Currently it's unclear what exactly is UB when you don't have `noundef`. Clarify it.
>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] [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.
More information about the llvm-commits
mailing list