This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch]Fix the aliasing on vector replacements to match the original scalar array


On Tue, May 10, 2005 at 01:58:08AM -0500, Keith Besaw wrote:

>       * tree-ssa-alias.c (new_type_alias): New procedure to
>         create a type memory tag for a pointer with a may-alias
>         set determined from a variable declaration.
>       * tree-flow.h: export declaration of new_type_alias
>       * tree-vect-transform (vect_create_data_ref_ptr): Call
>       new_type_alias when an type memory tag isn't available
>       for a reference.
>       (vectorizable_store): Use copy_virtual_operands to update
>       virtual defs in place (so that loop_version can be called).
>       Call mark_for_renaming for the virtual defs in case peeling
>       is done and virtual uses outside the loop need to be updated.
> 
OK with the changes below.  Could you add a comment in
init_tree_init_optimization_passes?  After vectorization we
cannot call pass_may_alias anymore.  You are creating alias
relations that are not supported by pass_may_alias.

It's something that needs fixing in aliasing, though.  What you
are trying to do should be supported.  Much of the alias harness
will change soon, so I'm not concerned about this limitation now.


> +void
> +new_type_alias (tree ptr, tree var)
> +{
>
Need comment documenting the function and its arguments.

> +  /* Note, TAG and its set of aliases are not marked for renaming.  */
>
Move this note to the documentation at the top of the function.

> -  /* If the memory tag of the original reference was not a type tag or
> -     if the pointed-to type of VECT_PTR has an alias set number
> -     different than TAG's, then we need to create a new type tag for
> -     VECT_PTR and add TAG to its alias set.  */
> -  if (var_ann (tag)->mem_tag_kind == NOT_A_TAG
> -      || get_alias_set (tag) != get_alias_set (TREE_TYPE (vect_ptr_type)))
> -    add_type_alias (vect_ptr, tag);
> +  /* If tag is a variable (and NOT_A_TAG) than a new type alias
> +     tag must be created with tag added to its may alias list.  */
> +  if (var_ann (tag)->mem_tag_kind == NOT_A_TAG)
> +    new_type_alias (vect_ptr, tag);
>
As Zdenek suggested, if new_type_alias can also be used from
ivopts, then let's get rid of add_type_alias.

> -  /* Mark all non-SSA variables in the statement for rewriting.  */
> -  mark_new_vars_to_rename (*vec_stmt);
> -	    
> -  /* The new vectorized statement will have better aliasing
> -     information, so some of the virtual definitions of the old
> -     statement will likely disappear from the IL.  Mark them to have
> -     their SSA form updated.  */
> -  FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_VMAYDEF)
> -    mark_sym_for_renaming (SSA_NAME_VAR (def));
> +  /* Copy the V_MAY_DEFS representing the aliasing of the original array
> +     element's definition to the vector's definition then update the
> +     defining statement.  The original is being deleted so the same
> +     SSA_NAMEs can be used.  */
> +  copy_virtual_operands (*vec_stmt, stmt);
> +

> +  FOR_EACH_SSA_DEF_OPERAND (def_p, *vec_stmt, iter, SSA_OP_VMAYDEF)
> +    {
> +      tree ssa_name = DEF_FROM_PTR (def_p);
> +      SSA_NAME_DEF_STMT (ssa_name) = *vec_stmt;
> +      mark_sym_for_renaming (SSA_NAME_VAR (ssa_name));
> +    }
>   
The original loop was more compact:

	  FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_VMAYDEF)
	    mark_sym_for_renaming (SSA_NAME_VAR (def));

Also add a comment describing why we need to mark V_MAY_DEFs for renaming.


Thanks.  Diego.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]