https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124746

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'm not sure what removed the restriction that we only hoist stmts from the
PHI block itself, but the following fixes it:

diff --git a/gcc/tree-ssa-phiprop.cc b/gcc/tree-ssa-phiprop.cc
index d244d6457e5..bb73230a86a 100644
--- a/gcc/tree-ssa-phiprop.cc
+++ b/gcc/tree-ssa-phiprop.cc
@@ -416,6 +416,9 @@ propagate_with_phi (basic_block bb, gphi *vphi, gphi *phi,
            goto next;
          if (!gimple_vdef (use_stmt))
            goto next;
+         /* If the store was conditional, we may not make it unconditional. 
*/
+         if (gimple_bb (use_stmt) != gimple_bb (phi))
+           goto next;

          /* As we replicate the lhs on each incoming edge all
             used SSA names have to be available there.  */

I'll look further tomorrow, but I'd appreciate a look from Andrew given he was
somehow breaking it (or exposing a latent issue) with phiprop changes.

Reply via email to