[llvm] [LangRef] Clarify cttz.elts returns poison for undersized result types (PR #206970)
Zhige Chen via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 05:45:04 PDT 2026
https://github.com/nofe1248 created https://github.com/llvm/llvm-project/pull/206970
Update the LangRef for `llvm.experimental.cttz.elts` and `llvm.vp.cttz.elts` to state that an undersized return type produces poison rather than UB, matching the intrinsic's speculatable behavior.
See also https://github.com/llvm/llvm-project/pull/206899#discussion_r3504289653.
>From 482b9a5e3e6cce382ebe518c07f0e8d68312d246 Mon Sep 17 00:00:00 2001
From: Zhige Chen <zhigec_cpp at outlook.com>
Date: Wed, 1 Jul 2026 20:35:16 +0800
Subject: [PATCH] [LangRef] Clarify cttz.elts returns poison for undersized
result types
---
llvm/docs/LangRef.rst | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 4d880494eb449..f1ac8cee05019 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -22221,8 +22221,8 @@ Arguments:
The first argument is the vector to be counted. This argument must be a vector
with integer element type. The return type must also be an integer type which is
wide enough to hold the maximum number of elements of the source vector. The
-behavior of this intrinsic is undefined if the return type is not wide enough
-for the number of elements in the input vector.
+result is poison if the return type is not wide enough for the number of
+elements in the input vector.
The second argument is a constant flag that indicates whether the intrinsic
returns a valid result if the first argument is all zero. If the first argument
@@ -27737,8 +27737,8 @@ Arguments:
The first argument is the vector to be counted. This argument must be a vector
with integer element type. The return type must also be an integer type which is
wide enough to hold the maximum number of elements of the source vector. The
-behavior of this intrinsic is undefined if the return type is not wide enough
-for the number of elements in the input vector.
+result is poison if the return type is not wide enough for the number of
+elements in the input vector.
The second argument is a constant flag that indicates whether the intrinsic
returns a valid result if the first argument is all zero.
More information about the llvm-commits
mailing list