For gcc.dg/vect/vect-bool-cmp.c, vectorizable_comparison would swap the comparison operands
in fn7 once for each copy, thus all odd copies would end up unswapped.
Regression tested on x86_64-pc-linux-gnu.
Committed as obvious.
2019-07-09  Joern Rennecke  <joern.renne...@riscy-ip.com>

        * tree-vect-stmts.c (vectorizable_comparison) <!slp_node>:
        Swap operands only once.

Index: tree-vect-stmts.c
===================================================================
--- tree-vect-stmts.c   (revision 273313)
+++ tree-vect-stmts.c   (working copy)
@@ -10369,7 +10369,7 @@ vectorizable_comparison (stmt_vec_info s
 
       if (!slp_node)
        {
-         if (swap_p)
+         if (swap_p && j == 0)
            std::swap (vec_rhs1, vec_rhs2);
          vec_oprnds0.quick_push (vec_rhs1);
          vec_oprnds1.quick_push (vec_rhs2);

Reply via email to