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]

[patch] vectorizer - improve loop location reports - part1


The dump reports in the vectorizer are prefixed with the line number of 
the loop that is being analyzed/transformed. We make a number of 
improvements to the way we obtain the loop line number -
1. Get the line-number of the loop exit condition instead of the line 
number of the first statement in the loop body.
2. Obtain the line number once instead of each time a printout is 
requested.

For example, the -fdump-tree-vect-stats of vect-1.c currently produces:

loop at vect-1.c:53: LOOP VECTORIZED.
loop at vect-1.c:60: LOOP VECTORIZED.
loop at vect-1.c:67: not vectorized: complicated access pattern.
loop at vect-1.c:75: LOOP VECTORIZED.
loop at vect-1.c:86: not vectorized: mixed data-types
loop at vect-1.c:95: not vectorized: possible dependence between data-refs 
a[i_283] and a[i_48]

After installing the two parts of this patch it will produce:

loop at vect-1.c:43: not vectorized: bad loop form. nested loop.
loop at vect-1.c:52: LOOP VECTORIZED.
loop at vect-1.c:59: LOOP VECTORIZED.
loop at vect-1.c:66: not vectorized: complicated access pattern.
loop at vect-1.c:74: LOOP VECTORIZED.
loop at vect-1.c:85: not vectorized: mixed data-types
loop at vect-1.c:94: not vectorized: possible dependence between data-refs 
a[i_283] and a[i_48]

Which is the correct loop location.


This patch is broken into two parts:
Part 2 (to be sent shortly) has the improvements described above.
Part 1 (included here) prepares the ground for it as described below.

This is a technical patch that replaces the usage of 'struct loop' within 
the vectorizer functions with 'struct _loop_vec_info'. By doing this we 
enable many functions in the vectorizer to share the information that was 
gathered during the vectorization analysis and stored in the loop_vinfo 
structure. Obtaining the line number once instead of each time a printout 
is requested is a good example for the advantages of this replacement.

This patch consists of:
1. Storing 'loop_vec_info' instead of 'loop' in 'stmt_vec_info'
2. Passing 'loop_vec_info' instead of 'loop' to the vectorizer's 
functions.
3. A few unrelated minor cleanups: added missing function declarations, 
and avoid 80 column overflow.

Reviewed by Dorit. Bootstrapped and tested on powerpc-suse-linux, 
i686-pc-linux-gnu and powerpc-darwin. 

ok for mainline?

Thanks,
Leehod

ChangeLog:

        * tree-vectorizer.c (vect_analyze_data_ref_dependence): Function
        declaration added.
        (vect_analyze_data_ref_dependences): Likewise.

        (vect_is_simple_use): Argument changed from loop structure to
        loop_vect_info structure.
        (vect_can_advance_ivs_p): Likewise.
        (vect_create_index_for_vector_ref): Likewise.
        (vect_update_ivs_after_vectorizer): Likewise.
        (new_stmt_vec_info): Likewise.

        (new_loop_vec_info): Second argument in call to new_stmt_vec_info 
was
        changed from loop to loop_vinfo.
        (vect_create_data_ref_ptr): First argument in call to
        vect_create_index_for_vector_ref was changed from loop to 
loop_vinfo.
        (vectorizable_assignment): Second argument in call to 
vect_is_simple_use
        was changed from loop to loop_vinfo.
        (vectorizable_operation): Likewise.
        (vectorizable_store): Likewise.
        (vect_mark_stmts_to_be_vectorized): Likewise.
        (vect_do_peeling_for_loop_bound): First argument in call to
        vect_update_ivs_after_vectorizer was changed from loop to 
loop_vinfo.
        (vect_analyze_operations): Argument in call to 
vect_can_advance_ivs_p
        was changed from loop to loop_vinfo.
        (vect_analyze_data_ref_dependences): Third argument in call to
        vect_analyze_data_ref_dependence was changed from loop to 
loop_vinfo.

        (vect_create_index_for_vector_ref): Get the loop from loop_vinfo.
        (vect_create_data_ref_ptr): Likewise.
        (vect_init_vector): Likewise.
        (vect_get_vec_def_for_operand): Likewise.
        (vectorizable_assignment): Likewise.
        (vectorizable_operation): Likewise.
        (vectorizable_store): Likewise.
        (vectorizable_load): Likewise.
        (vect_update_ivs_after_vectorizer): Likewise.
        (vect_is_simple_use): Likewise.
        (vect_analyze_data_ref_dependence): Likewise.
        (vect_analyze_pointer_ref_access): Likewise. 
        (vect_can_advance_ivs_p): Likewise.
 
        * tree-vectorizer.h: (_loop_vec_info): Definition and macros moved
        before _stmt_vec_info.
        (_stmt_vec_info): Loop field replaced by loop_vec_info.
        (STMT_VINFO_LOOP): Replaced with STMT_VINFO_LOOP_VINFO.
        (new_stmt_vec_info): Argument changed from loop structure to
        loop_vect_info structure

        (vect_analyze_data_ref_dependences): Unnecessary line was removed.
        (vect_analyze_offset_expr): Avoid 80 columns overflow.
        (vect_create_addr_base_for_vector_ref): Likewise.
        (vect_analyze_pointer_ref_access): Likewise.

Patch:

Attachment: looplineno.part1
Description: Binary data


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