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

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 02:13:37 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Ömer Sinan Ağacan (osa1)

<details>
<summary>Changes</summary>

Currently it's unclear what exactly is UB when you don't have `noundef`. Clarify it.

---
Full diff: https://github.com/llvm/llvm-project/pull/224236.diff


1 Files Affected:

- (modified) llvm/docs/LangRef.md (+6-4) 


``````````diff
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.

``````````

</details>


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


More information about the llvm-commits mailing list