[LangRef] Clarify the semantics of branch on undef
Summary: This patch clarifies the semantics of branching on undef value. Defining `br undef` as undefined behavior explains optimizations that use branch conditions, such as CVP (D76931) and GVN (propagateEquality). For `switch cond`, it is defined to raise UB if cond is an expression containing undef && cond is not frozen && it may yield different values. This allows that at the destination block the branch condition can be assumed to be frozen already (otherwise UB was already triggered). This condition is slightly stricter than MemorySanitizer, which allows undef-y condition if it always leads to the same destination, but it does not break MemorySanitizer because we are giving stricter constraint. Reviewers: efriedma, fhahn, nikic, spatel, jdoerfert, nlopes Reviewed By: nlopes Subscribers: regehr, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D76973
Loading
Please register or sign in to comment