Hi All,

This excludes value_replacement and store_elim from diamonds as they don't
handle the form properly.

Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
and no issues.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

        PR middle-end/106534
        * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Guard the
        value_replacement and store_elim from diamonds.

--- inline copy of patch -- 
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 
bdbf52916b0f88ee4f475e1fa306046d61f13d53..1e002c608591836ffb001724b3f469a8d042ae5e
 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -283,7 +283,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool 
do_hoist_loads, bool early_p)
          || (e1->flags & EDGE_FALLTHRU) == 0)
         continue;
 
-      if (do_store_elim)
+      if (do_store_elim && !diamond_p)
        {
          /* Also make sure that bb1 only have one predecessor and that it
             is bb.  */
@@ -310,7 +310,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool 
do_hoist_loads, bool early_p)
 
          /* Value replacement can work with more than one PHI
             so try that first. */
-         if (!early_p)
+         if (!early_p && !diamond_p)
            for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
              {
                phi = as_a <gphi *> (gsi_stmt (gsi));




-- 
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 
bdbf52916b0f88ee4f475e1fa306046d61f13d53..1e002c608591836ffb001724b3f469a8d042ae5e
 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -283,7 +283,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool 
do_hoist_loads, bool early_p)
          || (e1->flags & EDGE_FALLTHRU) == 0)
         continue;
 
-      if (do_store_elim)
+      if (do_store_elim && !diamond_p)
        {
          /* Also make sure that bb1 only have one predecessor and that it
             is bb.  */
@@ -310,7 +310,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool 
do_hoist_loads, bool early_p)
 
          /* Value replacement can work with more than one PHI
             so try that first. */
-         if (!early_p)
+         if (!early_p && !diamond_p)
            for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
              {
                phi = as_a <gphi *> (gsi_stmt (gsi));



Reply via email to