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] Fix base/access_fn mismatch in dependence analysis.





Hi,

This patch fixes the problem of base/access function mismatch of
INDIRECT_REFs in data dependence analysis.

Before checking dependence distance of two data-refs, we must be sure, that
the bases of the data-refs are the same. After that, we can check their
access functions to build the distance vector.

The problem with INDIRECT_REF was that its access function didn't match its
base. E.g., for access function
{p + off + const, +, 4B} the base was p, while it should not be a part of
initial condition. Now, the base address is p and off is stored in
DR_OFFSET, and the access_fn is {const/4, +, 1}. In general, with this
patch, acess_fn is related to DR_BASE_OBJECT if exists, or to
{DR_BASE_ADDRESS + DR_OFFSET} if there is no object for this DR. Therefore,
in order to decide if the bases of two data-refs differ, we compare base
objects if possible, or {base_addr + offset} pairs otherwise.

The flag detailed_analysis was removed, since the full analysis is needed
in order to create consistent DR in case of INDIRECT_REF.

Testcases are attached. This patch also fixes failure in
gcc.dg/tree-ssa/ltrans-8.c.

Bootstrapped and tested on ppc-darwin. Committed to autovect branch.

Thanks,
Ira

ChangeLog entry:

      * tree-data-ref.c (base_object_differ_p): Rename (from
      array_base_name_differ_p). Use alias analysis to handle
      pointers. Make static.
      (base_addr_differ_p): Make static. Call base_object_differ_p
      if there exist objects for both data-refs. Compare base
      address and offset otherwise.
      (dump_data_reference): Change base_name to base_object.
      (analyze_array): Change DR_BASE_NAME to DR_BASE_OBJECT,
      DR_INIT_OFFSET to DR_OFFSET, and initialize DR_INIT.
      (init_data_ref): Likewise.
      (address_analysis): Remove detailed_analysis parameter.
      (object_analysis): Remove detailed_analysis parameter.
      Change DR_BASE_NAME to DR_BASE_OBJECT.
      (analyze_offset): New function.
      (create_data_ref): Remove detailed_analysis parameter.
      Change DR_BASE_NAME to DR_BASE_OBJECT, DR_INIT_OFFSET to
      DR_OFFSET, and set DR_INIT. Update access_fn of INDIRECT_REF
      to match DR_BASE_OBJECT or DR_BASE_ADDRESS + DR_OFFSET.
      Fix printings.
      (initialize_data_dependence_relation): Change
      array_base_name_differ_p to base_object_differ_p.
      (find_data_references_in_loop): Remove detailed_analysis
      parameter. Change DR_BASE_NAME to DR_BASE_OBJECT,
      DR_INIT_OFFSET to DR_OFFSET, and initialize DR_INIT.
      (compute_data_dependences_for_loop): Remove detailed_analysis
      parameter.
      (analyze_all_data_dependences): Call
      compute_data_dependences_for_loop without detailed_analysis
      parameter.
      (analyze_all_data_dependences): Change
      array_base_name_differ_p to base_object_differ_p.
      * tree-data-ref.h (struct data_reference): Rename base_name
      to base_object, initial_offset to offset. Add new field,
      init. Update access macros.
      (find_data_references_in_loop): Remove detailed_analysis
      parameter.
      (compute_data_dependences_for_loop): Likewise.
      (array_base_name_differ_p): Remove.
      * tree-loop-linear.c (linear_transform_loops): Call
      compute_data_dependences_for_loop without detailed_analysis
      parameter.
      * tree-ssa-loop-niter.c (estimate_numbers_of_iterations_loop):
      Call find_data_references_in_loop without detailed_analysis
      parameter.
      * tree-vect-analyze.c (vect_analyze_data_ref_dependence): Add
      printing.
      (vect_analyze_data_refs): Call
      compute_data_dependences_for_loop without detailed_analysis
      parameter. Change DR_BASE_NAME to DR_BASE_OBJECT,
      DR_INIT_OFFSET to DR_OFFSET.
      * tree-vect-transform.c (vect_create_addr_base_for_vector_ref):
      Add DR_INIT to first access calculation.
      (vect_gen_niters_for_prolog_loop): Change DR_INIT_OFFSET to
      DR_OFFSET.


Patch:
(See attached file: diff.apr19)
Tests:
(See attached file: vect-105.c)(See attached file: vect-100.c)(See attached
file: vect-101.c)(See attached file: vect-102.c)(See attached file:
vect-103.c)(See attached file: vect-104.c)


Attachment: diff.apr19
Description: Binary data

Attachment: vect-105.c
Description: Binary data

Attachment: vect-100.c
Description: Binary data

Attachment: vect-101.c
Description: Binary data

Attachment: vect-102.c
Description: Binary data

Attachment: vect-103.c
Description: Binary data

Attachment: vect-104.c
Description: Binary data


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