[llvm] dbbd4e0 - [LangRef] select: describe behavior for undef and poison (#208724)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 02:32:35 PDT 2026


Author: Ralf Jung
Date: 2026-07-14T11:32:31+02:00
New Revision: dbbd4e0de70b62c2e05d8a650ddcdff954ef8d0f

URL: https://github.com/llvm/llvm-project/commit/dbbd4e0de70b62c2e05d8a650ddcdff954ef8d0f
DIFF: https://github.com/llvm/llvm-project/commit/dbbd4e0de70b62c2e05d8a650ddcdff954ef8d0f.diff

LOG: [LangRef] select: describe behavior for undef and poison (#208724)

The poison semantics is based on
https://llvm.org/docs/UndefinedBehavior.html#propagation-of-poison-through-select.
IMO this definitely should appear in the "semantics" section of the
`select` instruction. If this isn't part of the `select` semantics I
don't know what is.

The undef semantics are based on what Alive does.

Added: 
    

Modified: 
    llvm/docs/LangRef.md

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.md b/llvm/docs/LangRef.md
index f7e3ca8db80e1..f555ca543ffdc 100644
--- a/llvm/docs/LangRef.md
+++ b/llvm/docs/LangRef.md
@@ -13392,7 +13392,8 @@ values indicating the condition, and two values of the same {ref}`first class <t
 
 If the condition is an i1 and it evaluates to 1, the instruction returns
 the first value argument; otherwise, it returns the second value
-argument.
+argument. If the condition evaluates to `poison`, the instruction returns `poison`.
+If it evaluates to `undef`, the result is an `undef` representing the union of two value arguments (i.e., each use of this value can pick either value argument).
 
 If the condition is a vector of i1, then the value arguments must be
 vectors of the same size, and the selection is done element by element.


        


More information about the llvm-commits mailing list