[PATCH] D76973: [LangRef] Clarify the semantics of branch on undef

Juneyoung Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 28 09:40:14 PDT 2020


aqjune marked 4 inline comments as done.
aqjune added inline comments.


================
Comment at: llvm/docs/LangRef.rst:3457
+a not-frozen expression containing undef and it can be evaluted into different
+values.
+This explains optimizations that depend on branch conditions to construct
----------------
nikic wrote:
> This definition seems unnecessary confusing, just saying "Branching on undef is undefined behavior" should be sufficient here. Undef is not frozen by definition. There's also no meaningful concept of "contains undef" in this context, as branch conditions are always scalar, so the value can only be undef or not be undef. Expressions reduce to undef or not undef in the usual ways.
The tricky case is when a partially undef (e.g. `undef | 1`) is given to switch.
I rephrased the text to make it clear that switching on a value is UB if it is not frozen. This needed defining the notion of a frozen value above.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76973/new/

https://reviews.llvm.org/D76973





More information about the llvm-commits mailing list