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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Optimizing block #5

1>>> COND 1 = i_1 ge_expr R_6(D)
1>>> COND 0 = i_1 lt_expr R_6(D)
LKUP STMT inter0p_13 = PHI <inter0p_2>
          inter0p_13 = PHI <inter0p_2(4)>
2>>> STMT inter0p_13 = PHI <inter0p_2>
          inter0p_13 = PHI <inter0p_2(4)>
LKUP STMT inter1p_14 = PHI <inter0p_2>
          inter1p_14 = PHI <inter0p_2(4)>
FIND: inter0p_2
0>>> COPY inter1p_14 = inter0p_2

At least record_equivalences_from_phis sets the SSA value of both to inter0p_2.

But we don't propagate inter0p_2 into the conditionals because of

      /* Do not propagate copies if the propagated value is at a deeper loop
         depth than the propagatee.  Otherwise, this may move loop variant
         variables outside of their loops and prevent coalescing
         opportunities.  If the value was loop invariant, it will be hoisted
         by LICM and exposed for copy propagation.  */
      if (loop_depth_of_name (val) > loop_depth_of_name (op))
        return;

as inter0p_2 is defined inside the loop.  Note that we don't replace
inter1p_14 by inter0p_13 either because we recorded inter0p_2 for that
as well ...

So it seems the above limitation should be enforced in a different way
(or removed).  I don't get what the comment is after anyway...  both
FRE and PRE don't care and do the propagation (and the CSE).

Reply via email to