[Bug tree-optimization/50014] [4.7 Regression] Assertion failed in vect_get_vec_def_for_stmt_copy

irar at il dot ibm.com gcc-bugzilla@gcc.gnu.org
Mon Aug 8 12:28:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50014

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |irar at il dot ibm.com
         AssignedTo|unassigned at gcc dot       |irar at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #2 from Ira Rosen <irar at il dot ibm.com> 2011-08-08 12:27:44 UTC ---
Somehow when getting a copy of a vector operand in reduction we use a dummy
def_type, which causes that we try to make a copy of a constant instead of just
using it. 
I am going to test this patch:

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (revision 177423)
+++ tree-vect-loop.c    (working copy)
@@ -4310,7 +4310,7 @@ vectorizable_reduction (gimple stmt, gim
   VEC (tree, heap) *vec_oprnds0 = NULL, *vec_oprnds1 = NULL, *vect_defs =
NULL;
   VEC (gimple, heap) *phis = NULL;
   int vec_num;
-  tree def0, def1, tem;
+  tree def0, def1, tem, op0, op1 = NULL_TREE;

   /* In case of reduction chain we switch to the first stmt in the chain, but
      we don't update STMT_INFO, since only the last stmt is marked as
reduction
@@ -4767,8 +4767,6 @@ vectorizable_reduction (gimple stmt, gim
       /* Handle uses.  */
       if (j == 0)
         {
-          tree op0, op1 = NULL_TREE;
-
           op0 = ops[!reduc_index];
           if (op_type == ternary_op)
             {
@@ -4798,11 +4796,19 @@ vectorizable_reduction (gimple stmt, gim
         {
           if (!slp_node)
             {
-              enum vect_def_type dt = vect_unknown_def_type; /* Dummy */
-              loop_vec_def0 = vect_get_vec_def_for_stmt_copy (dt,
loop_vec_def0);
+              enum vect_def_type dt;
+              gimple dummy_stmt;
+              tree dummy;
+
+              vect_is_simple_use (ops[!reduc_index], loop_vinfo, NULL,
+                                  &dummy_stmt, &dummy, &dt);
+              loop_vec_def0 = vect_get_vec_def_for_stmt_copy (dt,
+                                                              loop_vec_def0);
               VEC_replace (tree, vec_oprnds0, 0, loop_vec_def0);
               if (op_type == ternary_op)
                 {
+                  vect_is_simple_use (op1, loop_vinfo, NULL, &dummy_stmt,
+                                      &dummy, &dt);
                   loop_vec_def1 = vect_get_vec_def_for_stmt_copy (dt,
                                                                
loop_vec_def1);
                   VEC_replace (tree, vec_oprnds1, 0, loop_vec_def1);



More information about the Gcc-bugs mailing list