]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end: Guard value_replacement and store_elim from seeing diamonds.
authorTamar Christina <tamar.christina@arm.com>
Fri, 5 Aug 2022 13:53:28 +0000 (14:53 +0100)
committerTamar Christina <tamar.christina@arm.com>
Fri, 5 Aug 2022 13:53:28 +0000 (14:53 +0100)
This excludes value_replacement and store_elim from diamonds as they don't
handle the form properly.

gcc/ChangeLog:

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

gcc/tree-ssa-phiopt.cc

index ef4c0b78f4e8fb4b323e8bb379602478994be9b6..0191b9cb254d880d512fc6969ef52016d1760575 100644 (file)
@@ -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));