]> git.ipfire.org Git - thirdparty/gcc.git/commit
phi-opt: Do limited form of cselim from phiopt [PR120533]
authorAndrew Pinski <quic_apinski@quicinc.com>
Fri, 6 Jun 2025 18:34:48 +0000 (11:34 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Sun, 8 Jun 2025 19:34:34 +0000 (12:34 -0700)
commit201cd2d3bef8e935eb9af04a516b9d224b5b8470
treea74b9592ee4c2bfa95e410cf78f0e6710568bf49
parent4f88f1593fac1f9b32045f7d97170913f93986f6
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_apinski@quicinc.com>
gcc/testsuite/gcc.dg/tree-ssa/phiprop-2.c
gcc/testsuite/gcc.dg/tree-ssa/pr35286.c
gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
gcc/testsuite/gcc.dg/tree-ssa/split-path-7.c
gcc/tree-ssa-phiopt.cc