https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118817
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- Oh, and we _do_ fold the stmt, but only w/o following SSA edges by means of gimple_build which is restricted. We fold the last stmt "extra" but only inplace and w/o following any edges. We are also not folding the NARY in place when PHI-translating it, we only try to simplify it down to a constant or SSA name. During VN itself we assume folded stmts, so there that's OK, but PHI translation should possibly re-fold before the lookup, so it probably should work more like vn_nary_build_or_lookup_1, mapping back a NARY result to the nary. fully_constant_expression via vn_nary_simplify does already all the hard work, we just throw away the result.