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] reduction related enhancements/fixes





This patch includes:

1) Reduction enhancements/fixes:

- We neglected to mark phis that are used in the loop by relevant/live
stmts as relevant/live as appropriate. This is important in order to detect
reduction that is used in the loop, and which is therefore not
vectorizable. The new testcase vect-noreduc.c is an example for such a
case.

- It's wrong to record the out-of-loop use of the reduction-variable,
because by the time we get to using it loop peeling may have taken place
which creates new BBs between our loop and the out-of-lop use we had
recorded in the field STMT_VINFO_EXTERNAL_USE. This field is removed by
this patch, and we find the relevant use using immediate-uses info. This
fix allows us to vectorized reduction when peeling takes place. As a result
testcase vect-reduc-3.c now gets vectorized.

- Reorganize a bit the code that handles reduction to make it more uniform
with the handling of other types of computations (these are the changes in
vect_get_vec_def_for_operand, get_initial_def_for_reduction and
vect_create_epilog_for_reduction).

- Handle reductions when the reduction variable is not the last argument
(e.g., previously we could handle only 'sum=a[i]+sum'; with this patch we
can also handle 'sum=sum+a[i]').

2) Other cleanups:

- Remove 'ifdef ENABLE_CHECKING' wrappers around gcc_asserts.
- When checking the dependence distance, check for 'distance % VF == 0'
(instead of 'distance == 0') and for 'abs (distance) > VF' (instead of
'distance > VF').

Bootstrapped and tested on powerpc-apple-darwin, committed to
autovect-branch

dorit

Changelog:

        * tree-vect-analyze.c (vect_analyze_operations): Fail vectorization
        in case of a relevant phi.
        (vect_analyze_data_ref_dependence): Check if distance modulo VF is
        zero. Check if absolute distance is greater than 0. Updated debug
        printouts accordingly.
        (vect_mark_relevant): Phis may be marked as relevant.
        (vect_mark_stmts_to_be_vectorized): Last use of a reduction does
not
        mark its defining phi as relevant. Update documentation
accordingly.
        (vect_pattern_recog_1): Remove setting of STMT_VINFO_EXTERNAL_USE.
        (vect_can_advance_ivs_p): Skip reduction phis.
        * tree-vect-transform.c (vect_get_vec_def_for_operand): Takes
        additional argument. Reduction is handled inside the switch. Return
a
        vector def instead of a scalar def for reduction by calling
        get_initial_def_for_reduction. The scalar_def is returned in the
new
        argument.
        (vectorizable_target_reduction_pattern, vectorizable_reduction)
        (vectorizable_assignment, vectorizable_operation,
vectorizable_store)
        (vectorizable_select): Update call to vect_get_vec_def_for_operand.
        (get_initial_def_for_reduction): Last argument changed from bool*
to
        tree*. Second argument name changed to init_val. Move
ADJUST_IN_EPILOG
        ifdefs.
        (vect_create_epilog_for_reduction): Update call to
        vect_get_vec_def_for_operand. Call to get_initial_def_for_reduction
        moved to vect_get_vec_def_for_operand. Remove ifdef
ADJUST_IN_EPILOG.
        Remove use of STMT_VINFO_EXTERNAL_USE, find immediate uses instead.
        (vect_update_ivs_after_vectorizer): Skip reduction phis.
        * tree-vectorizer.h (after_loop_use): Field removed from
stmt_vec_info.
        (STMT_VINFO_EXTERNAL_USE): Macro removed.

        * tree-vect-analyze.c (vect_determine_vectorization_factor)
        (vect_analyze_operations, vect_enhance_data_refs_alignment)
        (vect_stmt_relevant_p): Remove ENABLE_CHECKING guard around
gcc_assert.
        * tree-vect-transform (vect_finish_stmt_generation)
        (vectorizable_reduction, vectorizable_target_reduction_pattern)
        (vectorizable_target_reduction_pattern, vectorizable_assignment)
        (vectorizable_operation, vectorizable_select, vect_transform_loop)
        (vect_do_peeling_for_loop_bound, vect_do_peeling_for_alignment):
Remove
        ENABLE_CHECKING guard around gcc_assert.
        (vect_create_cond_for_align_checks): Replace an abort with a
gcc_assert.
        * tree-vectorizer.c (slpeel_update_phi_nodes_for_guard1)
        (new_stmt_vec_info): Remove setting of STMT_VINFO_EXTERNAL_USE.
        (vect_is_simple_use): Update documentation.
        (reduction_code_for_scalar_code): Update documentation. Swap
operands
        if needed.
        * tree-vect-transform.c (vect_get_new_vect_var): Remove redundant
code.
        * tree.def: Fix typo.

Patch:

(See attached file: autovect.june10)

Attachment: autovect.june10
Description: Binary data


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