mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			re PR tree-optimization/71752 (ICE in compute_live_loop_exits, at tree-ssa-loop-manip.c:229 w/ -O1 -ftree-vectorize)
2015-08-17 Alan Hayward <alan.hayward@arm.com> PR tree-optimization/71752 * tree-vect-loop.c (vectorizable_reduction): Keep SLP operand ordering. * tree-vect-slp.c (vect_get_slp_defs): Handle null operands. PR tree-optimization/71752 * gcc.dg/vect/pr71752.c: New From-SVN: r239542
This commit is contained in:
		
							parent
							
								
									dd42e908a0
								
							
						
					
					
						commit
						038000bd9d
					
				|  | @ -1,3 +1,9 @@ | ||||||
|  | 2015-08-17  Alan Hayward <alan.hayward@arm.com> | ||||||
|  | 
 | ||||||
|  | 	PR tree-optimization/71752 | ||||||
|  | 	* tree-vect-loop.c (vectorizable_reduction): Keep SLP operand ordering. | ||||||
|  | 	* tree-vect-slp.c (vect_get_slp_defs): Handle null operands. | ||||||
|  | 
 | ||||||
| 2016-08-17  Jakub Jelinek  <jakub@redhat.com> | 2016-08-17  Jakub Jelinek  <jakub@redhat.com> | ||||||
| 
 | 
 | ||||||
| 	* gimple-fold.c (gimple_fold_call): Use gimple_call_noreturn_p | 	* gimple-fold.c (gimple_fold_call): Use gimple_call_noreturn_p | ||||||
|  |  | ||||||
|  | @ -1,3 +1,8 @@ | ||||||
|  | 2015-08-17  Alan Hayward <alan.hayward@arm.com> | ||||||
|  | 
 | ||||||
|  | 	PR tree-optimization/71752 | ||||||
|  | 	* gcc.dg/vect/pr71752.c: New | ||||||
|  | 
 | ||||||
| 2016-08-17  Uros Bizjak  <ubizjak@gmail.com> | 2016-08-17  Uros Bizjak  <ubizjak@gmail.com> | ||||||
| 
 | 
 | ||||||
| 	* gfortran.dg/dec_init_2.f90: Use dg-add-options ieee. | 	* gfortran.dg/dec_init_2.f90: Use dg-add-options ieee. | ||||||
|  |  | ||||||
|  | @ -0,0 +1,19 @@ | ||||||
|  | /* { dg-do compile } */ | ||||||
|  | 
 | ||||||
|  | unsigned int q4, yg; | ||||||
|  | 
 | ||||||
|  | unsigned int | ||||||
|  | w6 (unsigned int z5, unsigned int jv) | ||||||
|  | { | ||||||
|  |   unsigned int *f2 = &jv; | ||||||
|  | 
 | ||||||
|  |   while (*f2 < 21) | ||||||
|  |     { | ||||||
|  |       q4 -= jv; | ||||||
|  |       z5 -= jv; | ||||||
|  |       f2 = &yg; | ||||||
|  |       ++(*f2); | ||||||
|  |     } | ||||||
|  |   return z5; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | @ -5444,7 +5444,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, | ||||||
|   auto_vec<tree> vect_defs; |   auto_vec<tree> vect_defs; | ||||||
|   auto_vec<gimple *> phis; |   auto_vec<gimple *> phis; | ||||||
|   int vec_num; |   int vec_num; | ||||||
|   tree def0, def1, tem, op0, op1 = NULL_TREE; |   tree def0, def1, tem, op1 = NULL_TREE; | ||||||
|   bool first_p = true; |   bool first_p = true; | ||||||
|   tree cr_index_scalar_type = NULL_TREE, cr_index_vector_type = NULL_TREE; |   tree cr_index_scalar_type = NULL_TREE, cr_index_vector_type = NULL_TREE; | ||||||
|   tree cond_reduc_val = NULL_TREE, const_cond_cmp = NULL_TREE; |   tree cond_reduc_val = NULL_TREE, const_cond_cmp = NULL_TREE; | ||||||
|  | @ -6090,18 +6090,24 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, | ||||||
|       /* Handle uses.  */ |       /* Handle uses.  */ | ||||||
|       if (j == 0) |       if (j == 0) | ||||||
|         { |         { | ||||||
|           op0 = ops[!reduc_index]; |  | ||||||
|           if (op_type == ternary_op) |  | ||||||
|             { |  | ||||||
|               if (reduc_index == 0) |  | ||||||
|                 op1 = ops[2]; |  | ||||||
|               else |  | ||||||
|                 op1 = ops[1]; |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
| 	  if (slp_node) | 	  if (slp_node) | ||||||
|             vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1, | 	    { | ||||||
|                                slp_node, -1); | 	      /* Get vec defs for all the operands except the reduction index,
 | ||||||
|  | 		ensuring the ordering of the ops in the vector is kept.  */ | ||||||
|  | 	      auto_vec<tree, 3> slp_ops; | ||||||
|  | 	      auto_vec<vec<tree>, 3> vec_defs; | ||||||
|  | 
 | ||||||
|  | 	      slp_ops.quick_push ((reduc_index == 0) ? NULL : ops[0]); | ||||||
|  | 	      slp_ops.quick_push ((reduc_index == 1) ? NULL : ops[1]); | ||||||
|  | 	      if (op_type == ternary_op) | ||||||
|  | 		slp_ops.quick_push ((reduc_index == 2) ? NULL : ops[2]); | ||||||
|  | 
 | ||||||
|  | 	      vect_get_slp_defs (slp_ops, slp_node, &vec_defs, -1); | ||||||
|  | 
 | ||||||
|  | 	      vec_oprnds0.safe_splice (vec_defs[(reduc_index == 0) ? 1 : 0]); | ||||||
|  | 	      if (op_type == ternary_op) | ||||||
|  | 		vec_oprnds1.safe_splice (vec_defs[(reduc_index == 2) ? 1 : 2]); | ||||||
|  | 	    } | ||||||
|           else |           else | ||||||
| 	    { | 	    { | ||||||
|               loop_vec_def0 = vect_get_vec_def_for_operand (ops[!reduc_index], |               loop_vec_def0 = vect_get_vec_def_for_operand (ops[!reduc_index], | ||||||
|  | @ -6109,6 +6115,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, | ||||||
|               vec_oprnds0.quick_push (loop_vec_def0); |               vec_oprnds0.quick_push (loop_vec_def0); | ||||||
|               if (op_type == ternary_op) |               if (op_type == ternary_op) | ||||||
|                { |                { | ||||||
|  | 		 op1 = (reduc_index == 0) ? ops[2] : ops[1]; | ||||||
|                  loop_vec_def1 = vect_get_vec_def_for_operand (op1, stmt); |                  loop_vec_def1 = vect_get_vec_def_for_operand (op1, stmt); | ||||||
|                  vec_oprnds1.quick_push (loop_vec_def1); |                  vec_oprnds1.quick_push (loop_vec_def1); | ||||||
|                } |                } | ||||||
|  |  | ||||||
|  | @ -3194,24 +3194,32 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, | ||||||
| { | { | ||||||
|   gimple *first_stmt; |   gimple *first_stmt; | ||||||
|   int number_of_vects = 0, i; |   int number_of_vects = 0, i; | ||||||
|   unsigned int child_index = 0; |  | ||||||
|   HOST_WIDE_INT lhs_size_unit, rhs_size_unit; |   HOST_WIDE_INT lhs_size_unit, rhs_size_unit; | ||||||
|   slp_tree child = NULL; |   slp_tree child = NULL; | ||||||
|   vec<tree> vec_defs; |   vec<tree> vec_defs; | ||||||
|   tree oprnd; |   tree oprnd; | ||||||
|   bool vectorized_defs; |   bool first_iteration = true; | ||||||
| 
 | 
 | ||||||
|   first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0]; |   first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0]; | ||||||
|   FOR_EACH_VEC_ELT (ops, i, oprnd) |   FOR_EACH_VEC_ELT (ops, i, oprnd) | ||||||
|     { |     { | ||||||
|  |       bool vectorized_defs = false; | ||||||
|  | 
 | ||||||
|  |       if (oprnd == NULL) | ||||||
|  | 	{ | ||||||
|  | 	  vec_defs = vNULL; | ||||||
|  | 	  vec_defs.create (0); | ||||||
|  | 	  vec_oprnds->quick_push (vec_defs); | ||||||
|  | 	  continue; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|       /* For each operand we check if it has vectorized definitions in a child
 |       /* For each operand we check if it has vectorized definitions in a child
 | ||||||
| 	 node or we need to create them (for invariants and constants).  We | 	 node or we need to create them (for invariants and constants).  We | ||||||
| 	 check if the LHS of the first stmt of the next child matches OPRND. | 	 check if the LHS of the first stmt of the next child matches OPRND. | ||||||
| 	 If it does, we found the correct child.  Otherwise, we call | 	 If it does, we found the correct child.  Otherwise, we call | ||||||
| 	 vect_get_constant_vectors (), and not advance CHILD_INDEX in order | 	 vect_get_constant_vectors ().  */ | ||||||
| 	 to check this child node for the next operand.  */ |       for (unsigned int child_index = 0; | ||||||
|       vectorized_defs = false; | 	   child_index < SLP_TREE_CHILDREN (slp_node).length (); child_index++) | ||||||
|       if (SLP_TREE_CHILDREN (slp_node).length () > child_index) |  | ||||||
|         { |         { | ||||||
|           child = SLP_TREE_CHILDREN (slp_node)[child_index]; |           child = SLP_TREE_CHILDREN (slp_node)[child_index]; | ||||||
| 
 | 
 | ||||||
|  | @ -3231,16 +3239,12 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, | ||||||
| 		     statements.  */ | 		     statements.  */ | ||||||
| 		  number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child); | 		  number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child); | ||||||
| 		  vectorized_defs = true; | 		  vectorized_defs = true; | ||||||
| 		  child_index++; | 		  break; | ||||||
| 		} | 		} | ||||||
| 	    } | 	    } | ||||||
| 	  else |  | ||||||
| 	    child_index++; |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|       if (!vectorized_defs) |       if (!vectorized_defs && first_iteration) | ||||||
|         { |  | ||||||
|           if (i == 0) |  | ||||||
| 	{ | 	{ | ||||||
| 	  number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); | 	  number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); | ||||||
| 	  /* Number of vector stmts was calculated according to LHS in
 | 	  /* Number of vector stmts was calculated according to LHS in
 | ||||||
|  | @ -3255,7 +3259,6 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, | ||||||
| 	      number_of_vects /= lhs_size_unit; | 	      number_of_vects /= lhs_size_unit; | ||||||
| 	    } | 	    } | ||||||
|         } |         } | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|       /* Allocate memory for vectorized defs.  */ |       /* Allocate memory for vectorized defs.  */ | ||||||
|       vec_defs = vNULL; |       vec_defs = vNULL; | ||||||
|  | @ -3276,6 +3279,8 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, | ||||||
|       /* For reductions, we only need initial values.  */ |       /* For reductions, we only need initial values.  */ | ||||||
|       if (reduc_index != -1) |       if (reduc_index != -1) | ||||||
|         return; |         return; | ||||||
|  | 
 | ||||||
|  |       first_iteration = false; | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Alan Hayward
						Alan Hayward