On Sun, 29 Mar 2009, Ira Rosen wrote:

> 
> > I will announce the time I am doing the last trunk -> alias-improvements
> > branch merge and freeze the trunk for that.
> >
> > Thus, this is a heads-up - if I collide with your planned merge schedule
> > just tell me and we can sort it out.
> 
> I was planning to commit the vectorizer reorganization patch (
> http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00573.html). Do you prefer
> that I wait, so it doesn't disturb the merge?

If you can commit the patch soon (like, before wednesday) you can go
ahead.  The differences are not big (see attachment below for what
is the difference between trunk and branch in tree-vect-*), so I think
I can deal with the reorg just fine.

Thanks,
Richard.


Index: gcc/tree-vectorizer.c
===================================================================
--- gcc/tree-vectorizer.c       (.../trunk)     (revision 145210)
+++ gcc/tree-vectorizer.c       (.../branches/alias-improvements)       
(revision 145211)
@@ -973,7 +973,7 @@ slpeel_can_duplicate_loop_p (const struc
   gimple orig_cond = get_loop_exit_condition (loop);
   gimple_stmt_iterator loop_exit_gsi = gsi_last_bb (exit_e->src);
 
-  if (need_ssa_update_p ())
+  if (need_ssa_update_p (cfun))
     return false;
 
   if (loop->inner
Index: gcc/tree-vect-analyze.c
===================================================================
--- gcc/tree-vect-analyze.c     (.../trunk)     (revision 145210)
+++ gcc/tree-vect-analyze.c     (.../branches/alias-improvements)       
(revision 145211)
@@ -3563,16 +3563,6 @@ vect_analyze_data_refs (loop_vec_info lo
           return false;
         }
 
-      if (!DR_SYMBOL_TAG (dr))
-        {
-          if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
-            {
-              fprintf (vect_dump, "not vectorized: no memory tag for ");
-              print_generic_expr (vect_dump, DR_REF (dr), TDF_SLIM);
-            }
-          return false;
-        }
-
       base = unshare_expr (DR_BASE_ADDRESS (dr));
       offset = unshare_expr (DR_OFFSET (dr));
       init = unshare_expr (DR_INIT (dr));
@@ -3804,7 +3794,7 @@ vect_stmt_relevant_p (gimple stmt, loop_
 
   /* changing memory.  */
   if (gimple_code (stmt) != GIMPLE_PHI)
-    if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
+    if (gimple_vdef (stmt))
       {
        if (vect_print_dump_info (REPORT_DETAILS))
          fprintf (vect_dump, "vec_stmt_relevant_p: stmt has vdefs.");
Index: gcc/tree-vect-transform.c
===================================================================
--- gcc/tree-vect-transform.c   (.../trunk)     (revision 145210)
+++ gcc/tree-vect-transform.c   (.../branches/alias-improvements)       
(revision 145211)
@@ -51,7 +51,7 @@ static bool vect_transform_stmt (gimple,
                                 slp_tree, slp_instance);
 static tree vect_create_destination_var (tree, tree);
 static tree vect_create_data_ref_ptr 
-  (gimple, struct loop*, tree, tree *, gimple *, bool, bool *, tree);
+  (gimple, struct loop*, tree, tree *, gimple *, bool, bool *);
 static tree vect_create_addr_base_for_vector_ref 
   (gimple, gimple_seq *, tree, struct loop *);
 static tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
@@ -1009,7 +1009,7 @@ vect_create_addr_base_for_vector_ref (gi
 static tree
 vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
                          tree offset, tree *initial_address, gimple *ptr_incr,
-                         bool only_init, bool *inv_p, tree type)
+                         bool only_init, bool *inv_p)
 {
   tree base_name;
   stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -1020,7 +1020,6 @@ vect_create_data_ref_ptr (gimple stmt, s
   tree vectype = STMT_VINFO_VECTYPE (stmt_info);
   tree vect_ptr_type;
   tree vect_ptr;
-  tree tag;
   tree new_temp;
   gimple vec_stmt;
   gimple_seq new_stmt_list = NULL;
@@ -1068,42 +1067,33 @@ vect_create_data_ref_ptr (gimple stmt, s
     }
 
   /** (1) Create the new vector-pointer variable:  **/
-  if (type)
-    vect_ptr_type = build_pointer_type (type);
-  else
-    vect_ptr_type = build_pointer_type (vectype);
-
-  if (TREE_CODE (DR_BASE_ADDRESS (dr)) == SSA_NAME
-      && TYPE_RESTRICT (TREE_TYPE (DR_BASE_ADDRESS (dr))))
-    vect_ptr_type = build_qualified_type (vect_ptr_type, TYPE_QUAL_RESTRICT);
+  vect_ptr_type = build_pointer_type (vectype);
   vect_ptr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
                                     get_name (base_name));
-  if (TREE_CODE (DR_BASE_ADDRESS (dr)) == SSA_NAME
-      && TYPE_RESTRICT (TREE_TYPE (DR_BASE_ADDRESS (dr))))
+
+  /* If any of the data-references in the stmt group does not conflict
+     with the created vector data-reference use a ref-all pointer instead.  */
+  if (STMT_VINFO_DR_GROUP_SIZE (stmt_info) > 1)
     {
-      get_alias_set (base_name);
-      DECL_POINTER_ALIAS_SET (vect_ptr)
-       = DECL_POINTER_ALIAS_SET (SSA_NAME_VAR (DR_BASE_ADDRESS (dr)));
+      gimple orig_stmt = STMT_VINFO_DR_GROUP_FIRST_DR (stmt_info);
+      do
+       {
+         if (!alias_sets_conflict_p (get_deref_alias_set (vect_ptr),
+                                     get_alias_set (gimple_assign_lhs 
(orig_stmt))))
+           {
+             vect_ptr_type = build_pointer_type_for_mode (vectype,
+                                                          ptr_mode, true);
+             vect_ptr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
+                                               get_name (base_name));
+             break;
+           }
+         orig_stmt = STMT_VINFO_DR_GROUP_NEXT_DR (vinfo_for_stmt (orig_stmt));
+       }
+      while (orig_stmt);
     }
 
   add_referenced_var (vect_ptr);
 
-  /** (2) Add aliasing information to the new vector-pointer:
-          (The points-to info (DR_PTR_INFO) may be defined later.)  **/
-  
-  tag = DR_SYMBOL_TAG (dr);
-  gcc_assert (tag);
-
-  /* If tag is a variable (and NOT_A_TAG) than a new symbol memory
-     tag must be created with tag added to its may alias list.  */
-  if (!MTAG_P (tag))
-    new_type_alias (vect_ptr, tag, DR_REF (dr));
-  else
-    {
-      set_symbol_mem_tag (vect_ptr, tag);
-      mark_sym_for_renaming (tag);
-    }
-
   /** 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
@@ -3327,7 +3317,7 @@ vectorizable_call (gimple stmt, gimple_s
       return false;
     }
 
-  gcc_assert (ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS));
+  gcc_assert (!gimple_vuse (stmt));
 
   if (modifier == NARROW)
     ncopies = LOOP_VINFO_VECT_FACTOR (loop_vinfo) / nunits_out;
@@ -3493,8 +3483,6 @@ vect_gen_widened_results_half (enum tree
 { 
   gimple new_stmt;
   tree new_temp; 
-  tree sym; 
-  ssa_op_iter iter;
  
   /* Generate half of the widened result:  */ 
   if (code == CALL_EXPR) 
@@ -3520,16 +3508,6 @@ vect_gen_widened_results_half (enum tree
     } 
   vect_finish_stmt_generation (stmt, new_stmt, gsi);
 
-  if (code == CALL_EXPR)
-    {
-      FOR_EACH_SSA_TREE_OPERAND (sym, new_stmt, iter, SSA_OP_ALL_VIRTUALS)
-        {
-          if (TREE_CODE (sym) == SSA_NAME)
-            sym = SSA_NAME_VAR (sym);
-          mark_sym_for_renaming (sym);
-        }
-    }
-
   return new_stmt;
 }
 
@@ -3694,9 +3672,6 @@ vectorizable_conversion (gimple stmt, gi
     case NONE:
       for (j = 0; j < ncopies; j++)
        {
-         tree sym;
-         ssa_op_iter iter;
-
          if (j == 0)
            vect_get_vec_defs (op0, NULL, stmt, &vec_oprnds0, NULL, slp_node); 
          else
@@ -3711,13 +3686,6 @@ vectorizable_conversion (gimple stmt, gi
              new_temp = make_ssa_name (vec_dest, new_stmt);
              gimple_call_set_lhs (new_stmt, new_temp);
              vect_finish_stmt_generation (stmt, new_stmt, gsi);
-             FOR_EACH_SSA_TREE_OPERAND (sym, new_stmt, iter, 
-                                        SSA_OP_ALL_VIRTUALS)
-               {
-                 if (TREE_CODE (sym) == SSA_NAME)
-                   sym = SSA_NAME_VAR (sym);
-                 mark_sym_for_renaming (sym);
-               }
              if (slp_node)
                VEC_quick_push (gimple, SLP_TREE_VEC_STMTS (slp_node), 
new_stmt);
            }
@@ -5394,7 +5362,7 @@ vectorizable_store (gimple stmt, gimple_
                                                 TREE_TYPE (vec_oprnd)));
          dataref_ptr = vect_create_data_ref_ptr (first_stmt, NULL, NULL_TREE, 
                                                  &dummy, &ptr_incr, false, 
-                                                 &inv_p, NULL);
+                                                 &inv_p);
          gcc_assert (!inv_p);
        }
       else 
@@ -5443,6 +5411,10 @@ vectorizable_store (gimple stmt, gimple_
            vec_oprnd = VEC_index (tree, result_chain, i);
 
          data_ref = build_fold_indirect_ref (dataref_ptr);
+         /* If accesses through a pointer to vectype do not alias the original
+            memory reference we have a problem.  This should never happen.  */
+         gcc_assert (alias_sets_conflict_p (get_alias_set (data_ref),
+                                            get_alias_set (gimple_assign_lhs 
(stmt))));
 
          /* Arguments are ready. Create the new vector stmt.  */
          new_stmt = gimple_build_assign (data_ref, vec_oprnd);
@@ -5633,7 +5605,7 @@ vect_setup_realignment (gimple stmt, gim
       pe = loop_preheader_edge (loop_for_initial_load);
       vec_dest = vect_create_destination_var (scalar_dest, vectype);
       ptr = vect_create_data_ref_ptr (stmt, loop_for_initial_load, NULL_TREE,
-                                 &init_addr, &inc, true, &inv_p, NULL_TREE);
+                                     &init_addr, &inc, true, &inv_p);
       data_ref = build1 (ALIGN_INDIRECT_REF, vectype, ptr);
       new_stmt = gimple_build_assign (vec_dest, data_ref);
       new_temp = make_ssa_name (vec_dest, new_stmt);
@@ -6016,8 +5988,6 @@ vect_create_mask_and_perm (gimple stmt, 
   stmt_vec_info next_stmt_info;
   int i, group_size, stride, dr_chain_size;
   tree first_vec, second_vec, data_ref;
-  tree sym;
-  ssa_op_iter iter;
   VEC (tree, heap) *params = NULL;
 
   /* Create a vector mask.  */
@@ -6055,12 +6025,6 @@ vect_create_mask_and_perm (gimple stmt, 
       data_ref = make_ssa_name (perm_dest, perm_stmt);
       gimple_call_set_lhs (perm_stmt, data_ref);
       vect_finish_stmt_generation (stmt, perm_stmt, gsi);
-      FOR_EACH_SSA_TREE_OPERAND (sym, perm_stmt, iter, SSA_OP_ALL_VIRTUALS)
-        {
-          if (TREE_CODE (sym) == SSA_NAME)
-            sym = SSA_NAME_VAR (sym);
-          mark_sym_for_renaming (sym);
-        }
 
       /* Store the vector statement in NODE.  */ 
       VEC_replace (gimple, SLP_TREE_VEC_STMTS (node), 
@@ -6605,7 +6569,7 @@ vectorizable_load (gimple stmt, gimple_s
         dataref_ptr = vect_create_data_ref_ptr (first_stmt,
                                                at_loop, offset, 
                                                &dummy, &ptr_incr, false, 
-                                               &inv_p, NULL_TREE);
+                                               &inv_p);
       else
         dataref_ptr = 
                bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt, NULL_TREE);
@@ -6649,9 +6613,9 @@ vectorizable_load (gimple stmt, gimple_s
                new_stmt = gimple_build_assign (vec_dest, data_ref);
                new_temp = make_ssa_name (vec_dest, new_stmt);
                gimple_assign_set_lhs (new_stmt, new_temp);
+               gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+               gimple_set_vuse (new_stmt, gimple_vuse (stmt));
                vect_finish_stmt_generation (stmt, new_stmt, gsi);
-               copy_virtual_operands (new_stmt, stmt);
-               mark_symbols_for_renaming (new_stmt);
                msq = new_temp;
 
                bump = size_binop (MULT_EXPR, vs_minus_1,
@@ -6666,6 +6630,10 @@ vectorizable_load (gimple stmt, gimple_s
            default:
              gcc_unreachable ();
            }
+         /* If accesses through a pointer to vectype do not alias the original
+            memory reference we have a problem.  This should never happen.  */
+         gcc_assert (alias_sets_conflict_p (get_alias_set (data_ref),
+                                            get_alias_set (gimple_assign_rhs1 
(stmt))));
          vec_dest = vect_create_destination_var (scalar_dest, vectype);
          new_stmt = gimple_build_assign (vec_dest, data_ref);
          new_temp = make_ssa_name (vec_dest, new_stmt);

Reply via email to