[PATCH] D126962: [SCCP] Don't mark edges feasible when resolving undefs

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 14:55:43 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:1450
+/// (e.g. for a phi node with one undef and one constant value, which becomes
+/// feasible later).
 ///
----------------
efriedma wrote:
> I don't think the example given in the comment is accurate. The lattice distinguishes between unknown and undef, so PHI nodes should propagate correctly.
> 
> The problem is other operations: for example, visitCastInst doesn't propagate undef values.  (This is an optimization: if the operand of a cast transitions from undef to a non-undef constant, we don't want to force the result of the cast to overdefined.  We might want to consider revisiting this once we're using poison more consistently.)
Yes, allowing the lattice value transition from undef -> constant is the point. We do make use of that for phi nodes as well, because we merge undef and C into C, not overdefined.


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

https://reviews.llvm.org/D126962



More information about the llvm-commits mailing list