This is the mail archive of the 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: [autovect][patch]Eliminate the need for variable renaming in thevectorizer

Thanks, Keith.

A few comments:

--> vect_transform_loop: use 'bool' for the new argument
('need_loop_closed_rewrite') instead of 'int'.

--> the places that set '*need_loop_closed_rewrite = 1;'
can be marked with '/* FORNOW.  */'.
Currently, the peeling scheme in the vectorizer does not maintain
loop-closed-ssa-form. When I merge the revised peeling scheme from mainline
to autovect branch, I will also make it preserve loop-closed form, and
together with your patch we could avoid calling the renamer entirely in the

--> 'need_loop_closed_rewrite' should also be set to '1' for the case when
the loop bound is known but doesn't divide by the vectorization factor (not
only the unknown-loop-bound case).

--> in:
> +           int num_args = PHI_NUM_ARGS (phi);
> +           for (j=0; j<num_args; j++)
> +            {
> +              edge phi_edge = PHI_ARG_EDGE (phi, j);
> +              if (!flow_bb_inside_loop_p (loop, phi_edge->src))
> +                {
> +                  SET_VUSE_OP (vuses, i, PHI_ARG_DEF (phi, j));
> +                  break;
> +                }
> +            }
Can we use the following instead of the above loop:
      e = loop_preheader_edge (loop);
      phi_arg_from_edge (phi, e);

--> question: why does the following update concern may-defs only, and not
also must-defs?
> +   /* Copy the V_MAY_DEFS representing the aliasing of the original
> +      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);
> +   v_may_defs = STMT_V_MAY_DEF_OPS (*vec_stmt);
> +   nv_may_defs = NUM_V_MAY_DEFS (v_may_defs);
> +
> +   for (i = 0; i < nv_may_defs; i++)
> +     {
> +       tree ssa_name = V_MAY_DEF_RESULT (v_may_defs, i);
> +       SSA_NAME_DEF_STMT (ssa_name) = *vec_stmt;
> +     }

--> about the description of the new function 'update_vuses_to_preheader':

> +    It's possible to vectorize a loop even though an SSA_NAME from a
> +    appears to be defined in a V_MAY_DEF in another statement in a loop.
> +    Once
       ^^^^ (One?)

> +    such case is when the VUSE is at the dereference of a __restricted__
> +    pointer in a load and the V_MAY_DEF
                                          ^ (is)

> +    at the dereference of a different
> +    __restricted__ pointer in a store.  Vectorization may result in
> +    copy_virtual_uses being called to copy the problem
                                                  ^^^^^^^ (problematic?)

> +    VUSE to a new statement
> +    statement
       ^^^^^^^^^ (duplication)

> +    that is being inserted in the loop preheader.  This procedure
> +    is called to change the SSA_NAME in the new statement's VUSE from
> +    SSA_NAME updated in the loop to the related SSA_NAME available on
> +    path entering the loop.  */
> +

We can also add the following to the function description:
When this function is called, we have the following situation:

        # vuse <name1>
        S1: vload
    do {
        # name1 = phi < name0 , name2>

        # vuse <name1>
        S2: vload

        # name2 = vdef <name1>
        S3: vstore


Stmt S1 was created in the loop preheader block as part of misaligned-load
handling. This function fixes the name of the vuse of S1 from 'name1' to

Let me know if its ok to commit your patch with the changes above.



                      Keith Besaw                                                                                                 
                      <        To:                                                 
                      >                         cc:       Dorit Naishlos/Haifa/IBM@IBMIL                                          
                      Sent by:                  Subject:  [autovect][patch]Eliminate the need for variable renaming in the        
                      gcc-patches-owner@         vectorizer                                                                       
                      30/11/2004 10:13                                                                                            

The vectorizer currently requires a call to rewrite_into_ssa to rename the
references associated with array element references that are replaced by
vector references.  This patch eliminates the need for the renaming.
loads in most cases use the same VUSE SSA_NAME as in the array element
load they replace.  Vector stores use the same V_MAY_DEF as the array
element store they replace with an update to the defining statement.

Tested on ppc
No differences in make check or in SPEC.

OK for autovect branch?


        * tree-vectorizer.c (update_vuses_to_preheader): new, fixup VUSEs
        loads added to loop preheader block.
        (vect_create_data_ref_ptr): remove code which sets the bitmap
        (vectorizable_store): call copy_virtual_operands to copy
        from array element store to vector store and then update the
        defining the virtual SSA_NAMES.
        (vectorizable_load): call copy_virtual_operands to copy VUSEs from
        array element load to vector load.  Call update_vuses_to_preheader
        loads inserted into loop preheader block.
        (vect_do_peeling_for_alignment): add need_loop_closed_rewrite
        (vect_transform_loop): add need_loop_closed_rewrite_parm.
        (vectorize_loops): eliminate call to rewrite_into_ssa, only call
        rewrite_into_loop_closed_ssa if tree_duplicate_loop_to_edge has
        called in vect_do_peeling_for_alignment or vect_transform_loop.
        *rs6000.c(altivect_init_builtins): add the "const" attribute to
        __builtin_altivec_mask_for_store and


#### vect.11-29.diff has been removed from this note on December 01, 2004
by Dorit Naishlos

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