https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102681
--- Comment #22 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:fe8475c500939011b90504304aec61bf6f48ac7d commit r12-4625-gfe8475c500939011b90504304aec61bf6f48ac7d Author: Richard Biener <rguent...@suse.de> Date: Fri Oct 22 10:32:36 2021 +0200 bootstrap/102681 - properly CSE PHIs with default def args The PR shows that we fail to CSE PHIs containing (different) default definitions due to the fact on how we now handle on-demand build of VN_INFO. The following fixes this in the same way the PHI visitation code does. On gcc.dg/ubsan/pr81981.c this causes one expected warning to be elided since the uninit pass sees the change <bb 4> [local count: 1073741824]: # u$0_2 = PHI <u$0_5(D)(3), i_3(D)(5)> - # cstore_11 = PHI <t$0_6(D)(3), i_3(D)(5)> v = u$0_2; - return cstore_11; + return u$0_2; and thus only one of the conditionally uninitialized uses (the other became dead). I have XFAILed the missing diagnostic, I don't see a way to preserve that. 2021-10-22 Richard Biener <rguent...@suse.de> PR bootstrap/102681 * tree-ssa-sccvn.c (vn_phi_insert): For undefined SSA args record VN_TOP. (vn_phi_lookup): Likewise. * gcc.dg/tree-ssa/ssa-fre-97.c: New testcase. * gcc.dg/ubsan/pr81981.c: XFAIL one case.