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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
In the light of PR101280 I am now testing the following alternate fix for the
original problem, avoiding this regression:

diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc
index 43045c5455e..43ef112a2d0 100644
--- a/gcc/gimple-loop-interchange.cc
+++ b/gcc/gimple-loop-interchange.cc
@@ -1043,8 +1043,11 @@ tree_loop_interchange::valid_data_dependences (unsigned
i_idx, unsigned o_idx,
            continue;

          /* Be conservative, skip case if either direction at i_idx/o_idx
-            levels is not '=' (for the inner loop) or '<'.  */
-         if (dist_vect[i_idx] < 0 || dist_vect[o_idx] <= 0)
+            levels is not '=' or '<'.  */
+         if (dist_vect[i_idx] < 0
+             || (DDR_REVERSED_P (ddr) && dist_vect[i_idx] > 0)
+             || dist_vect[o_idx] < 0
+             || (DDR_REVERSED_P (ddr) && dist_vect[o_idx] > 0))
            return false;
        }
     }

Reply via email to