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

--- Comment #7 from Robin Dapp <rdapp at gcc dot gnu.org> ---
Also fails on riscv with e.g.

-O3 -march=rv64gcbv_zvbb_zvl512b -DQEMU -mtune=generic-ooo -mmax-vectorization
--param=riscv-autovec-mode=V4QI

Any specific options for x86 apart from -O3?

The issue is pretty simple/stupid and I believe is the whole reason why I added
the second parameter of

vect_load_perm_consecutive_p (slp_tree node, unsigned start_idx)

in the first place:

@@ -7855,15 +7867,7 @@ vect_optimize_slp_pass::remove_redundant_permutations ()
       else
        {
          loop_vec_info loop_vinfo = as_a<loop_vec_info> (m_vinfo);
-         stmt_vec_info load_info;
-         bool this_load_permuted = false;
-         unsigned j;
-         FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), j, load_info)
-           if (SLP_TREE_LOAD_PERMUTATION (node)[j] != j)
-             {
-               this_load_permuted = true;
-               break;
-             }
+         bool this_load_permuted = !vect_load_perm_consecutive_p (node);

This is obviously wrong and what I wanted is that start_idx is not a start
index but a start value.  It usually doesn't help to know that a permutation is
consecutive from somewhere in the middle.  What is helpful, though, is to know
that it is consecutive starting with value x.

Testing a patch.

Reply via email to