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] Fix PR/18179 and use get_inner_reference in vectorizer.





Following rth's comment in
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01112.html, here is the patch
that switches to use get_inner_reference.

We call get_inner_reference in the function get_base_and_offset to handle
COMPONENT_REFs and ARRAY_REFs. A new function (vect_analyze_offset_expr)
analyzes the offset returned by get_inner_reference and extracts from it
the information required for the vectorizer - namely: offset to first
location accessed in the loop, alignment, and evolution in the loop.
Switching to use get_inner_reference allowed us to remove the functions
vect_compute_array_base_alignment,
vect_compute_array_ref_alignment,
vect_analyze_data_ref_accesses,
vect_analyze_data_ref_accesses,
and vect_get_first_index.

This change also fixes PR/18179, and the problem reported here:
http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00981.html.

Testcases are attached.

Bootstrapped and tested on ppc-darwin.

O.K. for mainline?

Thanks,
Ira

Changelog entry:

2004-11-04  Ira Rosen  <irar@il.ibm.com>

        PR tree-optimization/18179
        * tree-vectorizer.h (struct _stmt_vec_info): Add new fields:
        initial_offset and step, and macros to access them.
        * tree-vectorizer.c (vect_analyze_data_ref_accesses): Remove.
        (vect_analyze_data_ref_access): Remove.
        (vect_analyze_data_refs_alignment_and_access): New function.
Replaces
        vect_compute_data_refs_alignment and
vect_analyze_data_ref_accesses.
        (vect_compute_data_refs_alignment_and_access): New function.
Replaces
        vect_compute_data_ref_alignment.
        (vect_compute_data_ref_alignment_and_access): New function.
Replaces
        vect_compute_data_ref_alignment).
        (vect_get_first_index): Remove.
        (vect_compute_array_base_alignment): Remove.
        (vect_compute_array_ref_alignment): Remove.
        (vect_analyze_offset_expr): New function.
        (vect_get_base_and_offset): Rename (former name
        vect_get_base_and_bit_offset). Call get_inner_reference for
ARRAY_REF
        and COMPONENT_REF. Call vect_analyze_offset_expr. Compute step and
        offset.
        (new_stmt_vec_info): Initialize the new fields of stmt_vec_info.
        (vect_create_addr_base_for_vector_ref): Partly move the creation of
        base to vect_compute_data_ref_alignment_and_access.
        (vect_create_data_ref_ptr): Fix printings.
        (vect_update_inits_of_dr): Update offset of data-ref instead of its
        access-fn. Remove argument.
        (vect_update_inits_of_drs): Call vect_update_inits_of_dr with new
        arguments.
        (vect_is_simple_iv_evolution): Add call to unshare_expr.
        (vect_analyze_pointer_ref_access): Update step and offset fields.
        (vect_analyze_loop): Call
vect_analyze_data_refs_alignment_and_access.


Patch:
(See attached file: diff.nov4)

Testcases:
(See attached file: vect-84.c)(See attached file: vect-85.c)

Attachment: diff.nov4
Description: Binary data

Attachment: vect-84.c
Description: Binary data

Attachment: vect-85.c
Description: Binary data


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