diff options
author | Richard Biener <rguenther@suse.de> | 2021-08-31 10:28:40 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-09-01 12:54:14 +0200 |
commit | 153766ec8351d55cfe8bd6d69bdfc0c2cef71e56 (patch) | |
tree | ebb2c8b87ddc274e6732f491c48f03658a4c3780 /gcc/tree-vectorizer.h | |
parent | ea1a16420cd2cd23917a1fd8be08ea929e55a55b (diff) | |
download | gcc-153766ec8351d55cfe8bd6d69bdfc0c2cef71e56.zip gcc-153766ec8351d55cfe8bd6d69bdfc0c2cef71e56.tar.gz gcc-153766ec8351d55cfe8bd6d69bdfc0c2cef71e56.tar.bz2 |
tree-optimization/102139 - fix SLP DR base alignment
When doing whole-function SLP we have to make sure the recorded
base alignments we compute as the maximum alignment seen for a
base anywhere in the function is actually valid at the point
we want to make use of it.
To make this work we now record the stmt the alignment was derived
from in addition to the DRs innermost behavior and we use a
dominance check to verify the recorded info is valid when doing
BB vectorization. For this to work for groups inside a BB that are
separate by a call that might not return we now store the DR
analysis group-id permanently and use that for an additional check
when the DRs are in the same BB.
2021-08-31 Richard Biener <rguenther@suse.de>
PR tree-optimization/102139
* tree-vectorizer.h (vec_base_alignments): Adjust hash-map
type to record a std::pair of the stmt-info and the innermost
loop behavior.
(dr_vec_info::group): New member.
* tree-vect-data-refs.c (vect_record_base_alignment): Adjust.
(vect_compute_data_ref_alignment): Verify the recorded
base alignment can be used.
(data_ref_pair): Remove.
(dr_group_sort_cmp): Adjust.
(vect_analyze_data_ref_accesses): Store the group-ID in the
dr_vec_info and operate on a vector of dr_vec_infos.
* gcc.dg/torture/pr102139.c: New testcase.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r-- | gcc/tree-vectorizer.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 72e018e..7453d2a 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -106,10 +106,11 @@ struct stmt_info_for_cost { typedef vec<stmt_info_for_cost> stmt_vector_for_cost; -/* Maps base addresses to an innermost_loop_behavior that gives the maximum - known alignment for that base. */ +/* Maps base addresses to an innermost_loop_behavior and the stmt it was + derived from that gives the maximum known alignment for that base. */ typedef hash_map<tree_operand_hash, - innermost_loop_behavior *> vec_base_alignments; + std::pair<stmt_vec_info, innermost_loop_behavior *> > + vec_base_alignments; /************************************************************************ SLP @@ -1059,6 +1060,9 @@ public: data_reference *dr; /* The statement that contains the data reference. */ stmt_vec_info stmt; + /* The analysis group this DR belongs to when doing BB vectorization. + DRs of the same group belong to the same conditional execution context. */ + unsigned group; /* The misalignment in bytes of the reference, or -1 if not known. */ int misalignment; /* The byte alignment that we'd ideally like the reference to have, |