https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121720
--- Comment #9 from GCC 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:c30f58c3f7ec25a0ecb8d9bd36f8c90270e61993 commit r16-3945-gc30f58c3f7ec25a0ecb8d9bd36f8c90270e61993 Author: Richard Biener <rguent...@suse.de> Date: Wed Sep 17 12:56:56 2025 +0200 tree-optimization/121720 - missed PRE hoisting The following re-implements the fix for PR84830 where the original fix causes missed optimizations. The issue with PR84830 is that we end up growing ANTIC_IN value set during iteration which happens because we conditionally prune values based on ANTIC_OUT - TMP_GEN expressions. But when ANTIC_OUT was computed including the MAX set on one edge we fail to take into account the implicitly represented MAX expression set. The following rectifies this by not pruning the value set in bitmap_set_subtract_expressions in such case. This avoids the pruning from the ANTIC_IN value set when MAX is involved and thus later growing, removing the need to explicitly prune it with the last iteration set. PR tree-optimization/121720 * tree-ssa-pre.cc (bitmap_set_subtract_expressions): Add flag to tell whether we should copy instead of prune the value set. (compute_antic_aux): Remove intersection of ANTIC_IN with the old solution. When subtracting TMP_GEN from ANTIC_OUT do not prune the value set when MAX was involved in the ANTIC_OUT computation. * gcc.dg/tree-ssa/ssa-pre-36.c: New testcase.