https://gcc.gnu.org/g:e4d3ffc1992c74abdac9361169a29761bc158f20
commit r16-1283-ge4d3ffc1992c74abdac9361169a29761bc158f20 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Sun Jun 8 11:12:46 2025 -0700 cselim: Use get_virtual_phi instead of a loop in cond_if_else_store_replacement Don't inline finding of the virtual op phi node, instead use get_virtual_phi. This is based on the review of a different patch (https://gcc.gnu.org/pipermail/gcc-patches/2025-June/686076.html). Pushed as obvious after a bootstrap/test on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-phiopt.cc (cond_if_else_store_replacement): Use get_virtual_phi instead of inlining it. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com> Diff: --- gcc/tree-ssa-phiopt.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 2e4f9dad3270..381c048fc3d5 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -3773,14 +3773,7 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb, /* Handle the case with single store in THEN_BB and ELSE_BB. That is cheap enough to always handle as it allows us to elide dependence checking. */ - gphi *vphi = NULL; - for (gphi_iterator si = gsi_start_phis (join_bb); !gsi_end_p (si); - gsi_next (&si)) - if (virtual_operand_p (gimple_phi_result (si.phi ()))) - { - vphi = si.phi (); - break; - } + gphi *vphi = get_virtual_phi (join_bb); if (!vphi) return false; tree then_vdef = PHI_ARG_DEF_FROM_EDGE (vphi, single_succ_edge (then_bb));