https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83072
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The interesting bit is that during the stmt folding
/* For integral types with undefined overflow and C != 0 fold
x * C EQ/NE y * C into x EQ/NE y. */
(for cmp (eq ne)
(simplify
(cmp (mult:c @0 @1) (mult:c @2 @1))
(if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))
&& tree_expr_nonzero_p (@1))
(cmp @0 @2))))
has to apply.
The issue is that when EVRP records value-ranges that only hold temporarily
it doesn't update SSA_NAME_RANGE_INFO but only the internal lattice while
if the range is determined at the SSA definition point it also updates
SSA_NAME_RANGE_INFO.