https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102902
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> --- I guess fixed with: commit aa15952d646fd5dd569fce287b719a737ae66e4f (HEAD -> master, origin/trunk, origin/master, origin/HEAD) Author: Richard Biener <rguent...@suse.de> Date: Mon Oct 25 09:33:15 2021 +0200 tree-optimization/102920 - fix PHI VN with undefined args This fixes a latent issue exposed by now allowing VN_TOP in PHI arguments. We may only use optimistic equality when merging values on different edges, not when merging values on the same edge - in particular we may not choose the undef value on any edge when there's a not undef value as well. 2021-10-25 Richard Biener <rguent...@suse.de> PR tree-optimization/102920 * tree-ssa-sccvn.h (expressions_equal_p): Add argument controlling VN_TOP matching behavior. * tree-ssa-sccvn.c (expressions_equal_p): Likewise. (vn_phi_eq): Do not optimistically match VN_TOP. * gcc.dg/torture/pr102920.c: New testcase.