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]

Fw: [lno] [patch] vectorization with unknown loop bound


The following patch allows vectorizing loops which
bound is unknown at compile time.

Loop duplication is used as solution. If original loop was
executed 'n' iterations, then the first copy of the loop
(that will be vectorized late) will execute n-n%VF times
(VF is vectorization factor), while the second copy will remain serial
and execute n%VF times.

The function number_of_iterations_in_loop is used.
Thanks to Sebastian Pop for enhancing it recently to return symbolic values
(patch http://gcc.gnu.org/ml/gcc-patches/2004-04/msg01797.html).

I used some static functions from tree-ssa-loop-manip.c and
cfgloopmanip.c, as well the function force_gimple_operand() from
tree-ssa-loop-ivopts.c, so I changed these functions to non-static.
Alternatively it was possible to make this loop transformation
generic, that is a question whether it is worth doing.

Bootstrapped on powerpc-apple-darwin7.0.0

thanks,
Olga

             * tree-vectorizer.c (vect_transform_loop): New parameter;
             if bound is unknown, duplicates loop before vectorizing.
             (vect_transfrom_loop_bound): New parameter; now deal with
             symbolic loop bound.
             (vect_analyze_loop_with_symbolic_num_of_iters):
             (vect_duplicate_loop):
             (vect_copy_phi_nodes):
             (vect_rename_variables_in_loop):
             (vect_tree_split_edge):
             (vect_update_initial_conditions_of_duplicated_loop):
             (vect_tree_duplicate_loop):
             (vect_build_symbl_bound): New functions.
             (new_loop_vec_info): Initialize the new field loop_vec_info:
             symb_numb_of_iters.
             * tree-vectorizer.h (loop_vec_info: symb_numb_of_iters):
Added.
             (LOOP_VINFO_SYMB_NUM_OF_ITERS): Added.
             * cfgloopmanip.c (duplicate_loop, place_new_loop): Made
non-static.
             * tree-ssa-loop-ivopts.c (force_gimple_operand): Made
non-static.
             * tree-ssa-loop-manip.c (collect_defs): Non-static.
             (allocate_new_names): Made non-static. Added option to
allocate
             for original loop or not.
             (rename_op): Made non-static. Added input check.
             (rename_variables_in_bb): release_ssa_name only if defs of
             initial loop were also renamed.
             * testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-8.c:
             * testsuite/gcc.dg/tree-ssa-vect/tree-ssa-vect-none.c: Tests
with
             unknown loop bounds should now pass.

(See attached file: unknown_loop_bound.diff)

Attachment: unknown_loop_bound.diff
Description: Binary data


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