Patchwork Vectorizer referenced-vars cleanup

login
register
mail settings
Submitter Richard Guenther
Date July 17, 2012, 3:08 p.m.
Message ID <alpine.LNX.2.00.1207171707040.17088@jbgna.fhfr.qr>
Download mbox | patch
Permalink /patch/171450/
State New
Headers show

Comments

Richard Guenther - July 17, 2012, 3:08 p.m.
This was around in my tree for some time, consolidates calling
add_referenced_vars into vect_get_new_vect_var.  Also uses
create_tmp_reg consistently.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-07-17  Richard Guenther  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_get_new_vect_var): Add referenced
	vars here, use create_tmp_reg where appropriate.
	(vect_create_addr_base_for_vector_ref): Do not add referenced
	vars here, use create_tmp_reg where appropriate.
	(vect_create_data_ref_ptr): Likewise.
	(vect_create_destination_var): Likewise.
	(vect_permute_store_chain): Likewise.
	(vect_permute_load_chain): Likewise.
	* tree-vect-loop-manip.c (vect_create_cond_for_align_checks):
	Likewise.
	* tree-vect-loop.c (get_initial_def_for_induction): Likewise.
	* tree-vect-patterns.c (vect_recog_temp_ssa_var): Likewise.
	(vect_handle_widen_op_by_const): Likewise.
	* tree-vect-stmts.c (vect_init_vector): Likewise.
	(vectorizable_load): Likewise.

Patch

Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	(revision 189564)
+++ gcc/tree-vect-data-refs.c	(working copy)
@@ -3397,15 +3397,12 @@  vect_get_new_vect_var (tree type, enum v
   if (name)
     {
       char* tmp = concat (prefix, name, NULL);
-      new_vect_var = create_tmp_var (type, tmp);
+      new_vect_var = create_tmp_reg (type, tmp);
       free (tmp);
     }
   else
-    new_vect_var = create_tmp_var (type, prefix);
-
-  /* Mark vector typed variable as a gimple register variable.  */
-  if (TREE_CODE (type) == VECTOR_TYPE)
-    DECL_GIMPLE_REG_P (new_vect_var) = true;
+    new_vect_var = create_tmp_reg (type, prefix);
+  add_referenced_var (new_vect_var);
 
   return new_vect_var;
 }
@@ -3533,7 +3530,6 @@  vect_create_addr_base_for_vector_ref (gi
   vec_stmt = fold_convert (vect_ptr_type, addr_base);
   addr_expr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
                                      get_name (base_name));
-  add_referenced_var (addr_expr);
   vec_stmt = force_gimple_operand (vec_stmt, &seq, false, addr_expr);
   gimple_seq_add_seq (new_stmt_list, seq);
 
@@ -3732,8 +3728,6 @@  vect_create_data_ref_ptr (gimple stmt, t
       while (orig_stmt);
     }
 
-  add_referenced_var (aggr_ptr);
-
   /* Note: If the dataref is in an inner-loop nested in LOOP, and we are
      vectorizing LOOP (i.e., outer-loop vectorization), we need to create two
      def-use update cycles for the pointer: one relative to the outer-loop
@@ -3983,7 +3977,6 @@  vect_create_destination_var (tree scalar
   if (!new_name)
     new_name = "var_";
   vec_dest = vect_get_new_vect_var (type, kind, new_name);
-  add_referenced_var (vec_dest);
 
   return vec_dest;
 }
@@ -4144,8 +4137,7 @@  vect_permute_store_chain (VEC(tree,heap)
 
 	  /* Create interleaving stmt:
 	     high = VEC_PERM_EXPR <vect1, vect2, {0, nelt, 1, nelt+1, ...}>  */
-	  perm_dest = create_tmp_var (vectype, "vect_inter_high");
-	  DECL_GIMPLE_REG_P (perm_dest) = 1;
+	  perm_dest = create_tmp_reg (vectype, "vect_inter_high");
 	  add_referenced_var (perm_dest);
 	  high = make_ssa_name (perm_dest, NULL);
 	  perm_stmt
@@ -4157,8 +4149,7 @@  vect_permute_store_chain (VEC(tree,heap)
 	  /* Create interleaving stmt:
 	     low = VEC_PERM_EXPR <vect1, vect2, {nelt/2, nelt*3/2, nelt/2+1,
 						 nelt*3/2+1, ...}>  */
-	  perm_dest = create_tmp_var (vectype, "vect_inter_low");
-	  DECL_GIMPLE_REG_P (perm_dest) = 1;
+	  perm_dest = create_tmp_reg (vectype, "vect_inter_low");
 	  add_referenced_var (perm_dest);
 	  low = make_ssa_name (perm_dest, NULL);
 	  perm_stmt
@@ -4601,8 +4592,7 @@  vect_permute_load_chain (VEC(tree,heap)
 	  second_vect = VEC_index (tree, dr_chain, j+1);
 
 	  /* data_ref = permute_even (first_data_ref, second_data_ref);  */
-	  perm_dest = create_tmp_var (vectype, "vect_perm_even");
-	  DECL_GIMPLE_REG_P (perm_dest) = 1;
+	  perm_dest = create_tmp_reg (vectype, "vect_perm_even");
 	  add_referenced_var (perm_dest);
 
 	  perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, perm_dest,
@@ -4616,8 +4606,7 @@  vect_permute_load_chain (VEC(tree,heap)
 	  VEC_replace (tree, *result_chain, j/2, data_ref);
 
 	  /* data_ref = permute_odd (first_data_ref, second_data_ref);  */
-	  perm_dest = create_tmp_var (vectype, "vect_perm_odd");
-	  DECL_GIMPLE_REG_P (perm_dest) = 1;
+	  perm_dest = create_tmp_reg (vectype, "vect_perm_odd");
 	  add_referenced_var (perm_dest);
 
 	  perm_stmt = gimple_build_assign_with_ops3 (VEC_PERM_EXPR, perm_dest,
Index: gcc/tree-vect-loop-manip.c
===================================================================
--- gcc/tree-vect-loop-manip.c	(revision 189564)
+++ gcc/tree-vect-loop-manip.c	(working copy)
@@ -2249,7 +2255,7 @@  vect_create_cond_for_align_checks (loop_
 	gimple_seq_add_seq (cond_expr_stmt_list, new_stmt_list);
 
       sprintf (tmp_name, "%s%d", "addr2int", i);
-      addr_tmp = create_tmp_var (int_ptrsize_type, tmp_name);
+      addr_tmp = create_tmp_reg (int_ptrsize_type, tmp_name);
       add_referenced_var (addr_tmp);
       addr_tmp_name = make_ssa_name (addr_tmp, NULL);
       addr_stmt = gimple_build_assign_with_ops (NOP_EXPR, addr_tmp_name,
@@ -2263,7 +2269,7 @@  vect_create_cond_for_align_checks (loop_
         {
           /* create: or_tmp = or_tmp | addr_tmp */
           sprintf (tmp_name, "%s%d", "orptrs", i);
-          or_tmp = create_tmp_var (int_ptrsize_type, tmp_name);
+          or_tmp = create_tmp_reg (int_ptrsize_type, tmp_name);
           add_referenced_var (or_tmp);
 	  new_or_tmp_name = make_ssa_name (or_tmp, NULL);
 	  or_stmt = gimple_build_assign_with_ops (BIT_IOR_EXPR,
@@ -2281,7 +2287,7 @@  vect_create_cond_for_align_checks (loop_
   mask_cst = build_int_cst (int_ptrsize_type, mask);
 
   /* create: and_tmp = or_tmp & mask  */
-  and_tmp = create_tmp_var (int_ptrsize_type, "andmask" );
+  and_tmp = create_tmp_reg (int_ptrsize_type, "andmask" );
   add_referenced_var (and_tmp);
   and_tmp_name = make_ssa_name (and_tmp, NULL);
 
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	(revision 189564)
+++ gcc/tree-vect-loop.c	(working copy)
@@ -3034,8 +3034,6 @@  get_initial_def_for_induction (gimple iv
       /* iv_loop is the loop to be vectorized. Create:
 	 vec_init = [X, X+S, X+2*S, X+3*S] (S = step_expr, X = init_expr)  */
       new_var = vect_get_new_vect_var (scalar_type, vect_scalar_var, "var_");
-      add_referenced_var (new_var);
-
       new_name = force_gimple_operand (init_expr, &stmts, false, new_var);
       if (stmts)
 	{
@@ -3106,7 +3104,6 @@  get_initial_def_for_induction (gimple iv
 
   /* Create the induction-phi that defines the induction-operand.  */
   vec_dest = vect_get_new_vect_var (vectype, vect_simple_var, "vec_iv_");
-  add_referenced_var (vec_dest);
   induction_phi = create_phi_node (vec_dest, iv_loop->header);
   set_vinfo_for_stmt (induction_phi,
 		      new_stmt_vec_info (induction_phi, loop_vinfo, NULL));
Index: gcc/tree-vect-patterns.c
===================================================================
--- gcc/tree-vect-patterns.c	(revision 189564)
+++ gcc/tree-vect-patterns.c	(working copy)
@@ -206,7 +206,7 @@  type_conversion_p (tree name, gimple use
 static tree
 vect_recog_temp_ssa_var (tree type, gimple stmt)
 {
-  tree var = create_tmp_var (type, "patt");
+  tree var = create_tmp_reg (type, "patt");
 
   add_referenced_var (var);
   var = make_ssa_name (var, stmt);
@@ -501,7 +501,7 @@  vect_handle_widen_op_by_const (gimple st
     {
       /* Create a_T = (NEW_TYPE) a_t;  */
       *oprnd = gimple_assign_rhs1 (def_stmt);
-      tmp = create_tmp_var (new_type, NULL);
+      tmp = create_tmp_reg (new_type, NULL);
       add_referenced_var (tmp);
       new_oprnd = make_ssa_name (tmp, NULL);
       new_stmt = gimple_build_assign_with_ops (NOP_EXPR, new_oprnd, *oprnd,
Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c	(revision 189564)
+++ gcc/tree-vect-stmts.c	(working copy)
@@ -1283,7 +1283,6 @@  vect_init_vector (gimple stmt, tree val,
     }
 
   new_var = vect_get_new_vect_var (type, vect_simple_var, "cst_");
-  add_referenced_var (new_var);
   init_stmt = gimple_build_assign  (new_var, val);
   new_temp = make_ssa_name (new_var, init_stmt);
   gimple_assign_set_lhs (init_stmt, new_temp);
@@ -4544,7 +4543,6 @@  vectorizable_load (gimple stmt, gimple_s
 	      gcc_assert (TYPE_VECTOR_SUBPARTS (TREE_TYPE (op))
 			  == TYPE_VECTOR_SUBPARTS (idxtype));
 	      var = vect_get_new_vect_var (idxtype, vect_simple_var, NULL);
-	      add_referenced_var (var);
 	      var = make_ssa_name (var, NULL);
 	      op = build1 (VIEW_CONVERT_EXPR, idxtype, op);
 	      new_stmt
@@ -4562,7 +4560,6 @@  vectorizable_load (gimple stmt, gimple_s
 	      gcc_assert (TYPE_VECTOR_SUBPARTS (vectype)
 			  == TYPE_VECTOR_SUBPARTS (rettype));
 	      var = vect_get_new_vect_var (rettype, vect_simple_var, NULL);
-	      add_referenced_var (var);
 	      op = make_ssa_name (var, new_stmt);
 	      gimple_call_set_lhs (new_stmt, op);
 	      vect_finish_stmt_generation (stmt, new_stmt, gsi);