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]

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

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


             * 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_build_symbl_bound): New functions.
             (new_loop_vec_info): Initialize the new field loop_vec_info:
             * tree-vectorizer.h (loop_vec_info: symb_numb_of_iters):
             (LOOP_VINFO_SYMB_NUM_OF_ITERS): Added.
             * cfgloopmanip.c (duplicate_loop, place_new_loop): Made
             * tree-ssa-loop-ivopts.c (force_gimple_operand): Made
             * tree-ssa-loop-manip.c (collect_defs): Non-static.
             (allocate_new_names): Made non-static. Added option to
             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
             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]