LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 46144 - Fix passes that introduce new branches on undef/poison
Summary: Fix passes that introduce new branches on undef/poison
Status: NEW
Alias: None
Product: libraries
Classification: Unclassified
Component: Scalar Optimizations (show other bugs)
Version: trunk
Hardware: PC All
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on: 45956
Blocks:
  Show dependency tree
 
Reported: 2020-05-31 05:36 PDT by Florian Hahn
Modified: 2020-06-19 11:39 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Hahn 2020-05-31 05:36:25 PDT
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
Comment 1 Evgenii Stepanov 2020-06-01 13:23:37 PDT
It great to see that LLVM IR semantics is converging with MSan.
Comment 2 Florian Hahn 2020-06-19 11:39:26 PDT
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)