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>
---
 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 2e4f9dad327..381c048fc3d 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));
-- 
2.43.0

Reply via email to