https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109002
--- Comment #6 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:0132acc03cada2c3b47c48a205e821563153fc80 commit r13-6443-g0132acc03cada2c3b47c48a205e821563153fc80 Author: Richard Biener <rguent...@suse.de> Date: Fri Mar 3 10:41:29 2023 +0100 tree-optimization/109002 - partial PRE miscompilation Partial PRE ends up miscompiling the testcase in PR109002, likely involving a corner case when inifinite loops are involved. The following avoids the miscompilation by addressing a long-standing oddity that manifests in odd partial partial redundancies eliminated that are full redundancies. The oddity is that while we properly PHI translate the PA_IN set from the successors when computing PA_OUT but we fail to do the same for ANTIC_IN which is supposed to be unioned. That results in expressions with wrong virtual operands being placed in the PA_OUT/IN sets and the pruning machinery to go wrong because it assumes the expressions in the sets have virtual operands that are valid in the respective blocks. PR tree-optimization/109002 * tree-ssa-pre.cc (compute_partial_antic_aux): Properly PHI-translate ANTIC_IN. * gcc.dg/torture/pr109002.c: New testcase.