[ValueTracking] Take poison-generating metadata into account (PR59888)
In canCreateUndefOrPoison(), take not only poison-generating flags, but also poison-generating metadata into account. The helpers are written generically, but I believe the only case that can actually matter is !range on calls -- !nonnull and !align are only valid on loads, and those can create undef/poison anyway. Unfortunately, this negatively impacts logical to bitwise and/or conversion: For ctpop/ctlz/cttz we always attach !range metadata, which will now block the transform, because it might introduce poison. It would be possible to recover this regression by supporting a ConsiderFlagsAndMetadata=false mode in impliesPoison() and clearing flags/metadata on visited instructions. Fixes https://github.com/llvm/llvm-project/issues/59888. Differential Revision: https://reviews.llvm.org/D142115
Loading
Please sign in to comment