Currently there are some passes that may introduce new branches on undef/poison, which h potentially introduces UB where there was none before. While the LangRef was clear about branch on poison being UB, recently it was also clarified that this applies to branches on undef as well (https://reviews.llvm.org/rG05f0e598ab265a80fedb23225cde4176f11774ac). There has been some discussion about problematic passes (https://reviews.llvm.org/D76973, https://reviews.llvm.org/D80875. Nuno mentioned "The passes we are aware that introduce branch on poison are: IndVarSimplify, LoopUnswitch, SimpleLoopUnswitch, and SimpifyCFG. (https://web.ist.utl.pt/nuno.lopes/alive2/index.php?hash=4beb2b117e2fdd2c)" Eli mentioned that some passes condition certain transforms on the`Attribute::SanitizeMemory`attribute, because of MemSAN does not like new branches on undef/poison values. See also https://bugs.llvm.org/show_bug.cgi?id=28054
It great to see that LLVM IR semantics is converging with MSan.
For now, we decided to delay a few changes in LLVM until there's some progress on this. In particular https://reviews.llvm.org/D80875 and marking ranges from branch conditions as not containing undef in SCCP (was part of https://reviews.llvm.org/D81756)