https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120533
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:201cd2d3bef8e935eb9af04a516b9d224b5b8470 commit r16-1285-g201cd2d3bef8e935eb9af04a516b9d224b5b8470 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Fri Jun 6 11:34:48 2025 -0700 phi-opt: Do limited form of cselim from phiopt [PR120533] So currently cselim is limited to targets which have conditional move and also happens later in the pipeline. This adds the limited form of cselim; where there is only one store in the two sides and no loads after the store. This fixes phiprop-2.c for gcn target and now can match the MIN in phiopt1 so it moves the matching of MIN to phiopt1. The other testcases already disable cselim so they need to disable phiopt too. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/120533 gcc/ChangeLog: * tree-ssa-phiopt.cc (cond_if_else_store_replacement_limited): New function. (pass_phiopt::execute): Call cond_if_else_store_replacement_limited for diamand case. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr35286.c: Add -fno-ssa-phiopt. * gcc.dg/tree-ssa/split-path-6.c: Likewise. * gcc.dg/tree-ssa/split-path-7.c: Likewise. * gcc.dg/tree-ssa/phiprop-2.c: Move the check for MIN_EXPR to phiopt1. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>