Skip to content

Commit 9e6c3fe

Browse files
committed
merge note
1 parent 0a65952 commit 9e6c3fe

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/docs/UndefinedBehavior.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ Undef Values
145145
------------
146146
.. warning::
147147
Undef values are deprecated and should be used only when strictly necessary.
148-
No new uses should be added unless justified.
148+
Uses of undef values should be restricted to representing loads of
149+
uninitialized memory. This is the only part of the IR semantics that cannot
150+
be replaced with alternatives yet (work in ongoing).
149151

150152
An undef value represents any value of a given type. Moreover, each use of
151153
an instruction that depends on undef can observe a different value.
@@ -202,11 +204,6 @@ This optimization is wrong just because undef values exist, even if they are
202204
not used in this part of the program as LLVM has no way to tell if ``%v`` is
203205
undef or not.
204206

205-
.. note::
206-
Uses of undef values should be restricted to representing loads of
207-
uninitialized memory. This is the only part of the IR semantics that cannot
208-
be replaced with alternatives yet (work in ongoing).
209-
210207
Looking at the value lattice, ``undef`` values can only be replaced with either
211208
a ``freeze`` instruction or a concrete value.
212209
A consequence is that giving undef as an operand to an instruction that triggers
@@ -391,3 +388,6 @@ The lattice of values in LLVM is:
391388
immediate UB > poison > undef > freeze(poison) > concrete value.
392389
It is only valid to transform values from the left to the right (e.g., a poison
393390
value can be replaced with a concrete value, but not the other way around).
391+
392+
Undef is now deprecated and should be used only to represent loads of
393+
uninitialized memory.

0 commit comments

Comments
 (0)