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]

[autovect,committed]: vectorizer cleanups (and prep for outer-loop vectorization)


A few cleanups (really technical things, no new functionality), some of
which will be also useful for outer-loop vectorization:

o Remove the field exit_cond from loop_vec_info, which used to hold the
loop-exit stmt. Instead, a stmt that is identified as a loop-exit control
stmt is marked as a 'loop_exit_ctrl_vec_info_type' (new enum value for
stmt_vec_info_type).  This will be useful when looking at outer-loops
because we have more than one stmt like that in the loop (there's also one
in the inner-loop).

o Vectorization of induction is currently done upon encountering a use of
the induction variable. Instead, we now vectorize the induction earlier,
when we encounter the respective induction phi-node. This simplifies things
a bit cause it's more in-line with how we vectorize other things (when we
encounter a use of the induction we just get the vector def from the
STMT_VINFO_VEC_STMT field of the defining phi-node), and also we don't need
to worry about vectorizing the same induction multiple times.  When looking
at outer-loops this will be even more useful cause when we vectorize a
phi-node we know exactly relative to which loop-nest is the induction, and
don't need any extra logic to check for that.

o Reorganize the calls to the vectorizable_* functions: In the drivers that
call these functions (vect_analyze_operations and vect_transform_stmt), we
currently call most of these functions only for RELEVANT_P stmts, and then
call vectorizable_reduction only for LIVE_P stmts. Now, instead, each of
the vectorizable_* functions checks that STMT_VINFO_RELEVANT/LIVE_P are as
expected, and in the two driver functions we don't check for
STMT_VINFO_RELEVANT_P anymore, but apply the vectorizable_* functions to
all stmts.  When looking at outer-loops this is useful because a reduction
(in the inner-loop) may now be marked RELEVANT (if it is used in the
outer-loop), and not only LIVE as it is currently.

o A bunch of other cleanups (that are not necessarily inspired by
outer-loop vectorization): Factor out code from
vect_mark_stmts_to_be_vectorized to process_use; Remove the '#ifdef
ADJUST_IN_EPILOG' and the code path that was disabled by it (which removes
unused code and simplifies the function); Add a flag to allow disabling
tree-reassociation, to help test reductions that are otherwise transformed
by reassociation to something we currently don't recognize; Fix
indentation; A few ther small miscellaneous stuff.

Bootstrapped and tested (full regression testing) on powerpc-linux and
i386-linux.
Committed to autovect-branch. I think I'll submit it to mainline as well.

dorit

ChangeLog:

        * tree-vectorizer.h (_loop_vec_info): Remove field exit_cond.
        (stmt_vec_info_type): Add enum value loop_exit_ctrl_vec_info_type.
        * tree-vectorizer.c (new_loop_vec_info): Remove setting of
        LOOP_VINFO_EXIT_COND.
        * tree-vect-analyze.c (vect_stmt_relevant_p): Replace use of
        LOOP_VINFO_EXIT_COND with use of loop_exit_ctrl_vec_info_type.
        (vect_analyze_loop_form): Likewise.

        * tree-vectorizer.h (stmt_vec_info_type): Add enum value
        induc_vec_info_type.
        (vectorizable_induction): New function declaration.
        * tree-vect-transform.c (get_initial_def_for_induction): No need to
        check if already vectorized.  Find first place in BB where nre
stmts
        can be inserted.
        (vectorizable_induction): New function.
        (vect_transform_stmt): Add case for induc_vec_info_type to call
        vectorizable_induction.
        (vect_transform_loop): Consider phis for vectorization.
        * tree-vect-analyze.c (analyze_operations): Call
        vectorizable_induction when analyzing phis and when analyzing
        stmts.

        * tree-vectorizer.c (vect_is_simple_use): Remove redundant check.
        (destroy_loop_vec_info): Set loop->aux to NULL.

        * tree-vect-analyze.c (vect_determine_vectorization_factor):
Simplify
        condition. Add dump print.
        (vect_analyze_operations): Fix indentation.  Fix a comment.  Fix a
        print message.
        (vect_analyze_scalar_cycles): Fix indentation.
        (vect_enhance_data_refs_alignment): Fix check in case of peeling.
        (vect_mark_relevant): Include phis in relevance analysis.
        (process_use): New function.
        (vect_mark_stmts_to_be_vectorized): Factor out code to process_use.
        Check phis in all bbs.

        * tree-vect-patterns.c (widened_name_p): Remove redundant check.

        * tree-vect-analyze.c (vect_analyze_operations): Reorganize calls
to
        vectorizable_* functions.
        * tree-vect-transform.c (vectorizable_call): Add check for
        STMT_VINFO_RELEVANT_P, STMT_VINFO_DEF_TYPE and STMT_VINFO_LIVE_P.
        (vectorizable_store): likewise.
        (vectorizable_conversion): Add check for STMT_VINFO_DEF_TYPE.
        Add comments.
        (vectorizable_operation, vectorizable_type_demotion): Likewise.
        (vectorizable_type_promotion, vectorizable_load): Likewise.
        (vectorizable_live_operation, vectorizable_condition): Likewise.
        (vectorizable_assignment): Add check for STMT_VINFO_DEF_TYPE and
        STMT_VINFO_LIVE_P.
        (vect_transform_stmt): Reorganize calls to vectorizable_*
functions.
        (vect_analyze_loop_form): Use the new NITERS_KNOWN_P macro so that
        this check could be done without creating a loop_vinfo first.
Record
        loop_vinfo in loop->aux.

        * tree-vect-transform.c (get_initial_def_for_reduction): Clean away
        the unused code for reduction without adjust-in-epilog to simplify
the
        function.

        * tree-vect-transform.c (vect_transform_loop): Add an assert.

        * tree-ssa-reassoc.c (gate_reassoc): New function.
        * common.opt (tree-reassoc): New flag.
        (pass_reassoc): Add gate.


(See attached file: autovect-cleanups.mar27.txt)

Attachment: autovect-cleanups.mar27.txt
Description: Text document


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