[05/46] Fix make_ssa_name call in vectorizable_reduction
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 31 Jul 2018 14:21:32 +0000 (14:21 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 31 Jul 2018 14:21:32 +0000 (14:21 +0000)
The usual vectoriser dance to create new assignments is:

    new_stmt = gimple_build_assign (vec_dest, ...);
    new_temp = make_ssa_name (vec_dest, new_stmt);
    gimple_assign_set_lhs (new_stmt, new_temp);

but one site in vectorizable_reduction used:

    new_temp = make_ssa_name (vec_dest, new_stmt);

before creating new_stmt.

This method of creating statements probably needs cleaning up, but
that's for another day...

2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-loop.c (vectorizable_reduction): Fix an instance in
which make_ssa_name was called with new_stmt before new_stmt
had been created.

From-SVN: r263120

gcc/ChangeLog
gcc/tree-vect-loop.c

index 122d99f6e4a9a2e8d7c068afc5f1d39ce0b40b80..9a1956af7442a217373320c5c14a23290217268c 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * tree-vect-loop.c (vectorizable_reduction): Fix an instance in
+       which make_ssa_name was called with new_stmt before new_stmt
+       had been created.
+
 2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-loop.c (vect_valid_reduction_input_p): New function,
index dbb14ee805aa7d641c80425ec912d2e36579393b..bb89bf02c919e7e83dc4739517b847143f23ce3b 100644 (file)
@@ -7210,9 +7210,10 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
              if (op_type == ternary_op)
                vop[2] = vec_oprnds2[i];
 
-             new_temp = make_ssa_name (vec_dest, new_stmt);
-             new_stmt = gimple_build_assign (new_temp, code,
+             new_stmt = gimple_build_assign (vec_dest, code,
                                              vop[0], vop[1], vop[2]);
+             new_temp = make_ssa_name (vec_dest, new_stmt);
+             gimple_assign_set_lhs (new_stmt, new_temp);
            }
          vect_finish_stmt_generation (stmt, new_stmt, gsi);