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] [patch] use conditional loop-bound for simple cases


This patch adds support for building a conditional loop-bound when
number_of_latch_executions returns a maybe_zero expression, as explained in
http://gcc.gnu.org/ml/gcc-patches/2007-06/msg00136.html. It's just adding a
minimal support; if the conditional loop-bound expression actually needs to
be generated and inserted into the code (as is the case when we do peeling
to align access/loop-bound, where we need to use the loop-bound expression
to compute the number of iterations to peel), then we don't vectorize,
because that requires a bit of additional functionality to fixup the CFG
and ssa-form of the code generated by the gimplifier for the conditional
loop-bound (as also explained in the thread above). I haven't decided
if/when I actually want to complete these missing bits to support
conditional loop-bound also in the case of peeling, so in the meantime I'm
just committing what I have to autovect-branch, and will probably come back
to this later.

Bootstrapped with vectorization enabled and tested on the vectorizer
testcases on i386-linux and powerpc-linux. Committed to autovect-branch.

dorit


        * tree-scalar-evolutions.c (number_of_latch_executions_1): New.
        Contains code that was factored out from
number_of_latch_executions.
        (number_of_latch_executions): Call number_of_latch_executions_1
        instead of code that was factored out.
        (number_of_exit_cond_executions): Takes additional argument
        may_be_zero. Call  number_of_latch_executions_1 instead of
        number_of_latch_executions.
        * tree-scalar-evolutions.h (number_of_latch_executions_1): New.
        (number_of_exit_cond_executions): Takes additional argument.
        * tree-vect-analyze.c (vect_analyze_operations): Avoid
vectorization
        in case the loop-bound is a COND_EXPR and peeling needs to be done.
        (vect_get_loop_niters): Call number_of_exit_cond_executions with
        additional argument may_be_zero. Use it to build a (potentially)
        conditional expression for the loop niters.

        * tree-vect-transform.c (vect_generate_tmps_on_preheader): Remove
        redundant code.


(See attached file: autovect.condlb.txt)

Attachment: autovect.condlb.txt
Description: Text document


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