From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 0DBB23858428; Mon, 8 Nov 2021 12:35:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DBB23858428 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9223] Refactor BB splitting of DRs for SLP group analysis X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 19dcea67ac40cfdeb396fa264ebbe04fbe61fdc0 X-Git-Newrev: fa181c4803494e4a55aae09393f92fd04ae76df3 Message-Id: <20211108123533.0DBB23858428@sourceware.org> Date: Mon, 8 Nov 2021 12:35:33 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2021 12:35:33 -0000 https://gcc.gnu.org/g:fa181c4803494e4a55aae09393f92fd04ae76df3 commit r11-9223-gfa181c4803494e4a55aae09393f92fd04ae76df3 Author: Richard Biener Date: Fri Aug 20 11:32:00 2021 +0200 Refactor BB splitting of DRs for SLP group analysis This uses the group_id computed to ensure DRs in different BBs do not get merged into a DR group. To achieve this we seed the group from the BB index when group_ids are not computed and we make sure to bump the group_id when advancing to the next BB for BB SLP analysis. This paves the way for relaxing the grouping for BB vectorization by adjusting its group_id computation. 2021-08-20 Richard Biener * tree-vect-data-refs.c (dr_group_sort_cmp): Do not compare BBs. (vect_analyze_data_ref_accesses): Likewise. Assign the BB index as group_id when dataref_groups were not computed. * tree-vect-slp.c (vect_slp_bbs): Bump current_group when we advace to the next BB. (cherry picked from commit 37744f8260857005c8409c9e2e633a05c768a7dd) Diff: --- gcc/tree-vect-data-refs.c | 21 ++++++++------------- gcc/tree-vect-slp.c | 2 ++ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 9366660e3ff..4fa6e156204 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2835,12 +2835,6 @@ dr_group_sort_cmp (const void *dra_, const void *drb_) if (dra == drb) return 0; - /* DRs in different basic-blocks never belong to the same group. */ - int bb_index1 = gimple_bb (DR_STMT (dra))->index; - int bb_index2 = gimple_bb (DR_STMT (drb))->index; - if (bb_index1 != bb_index2) - return bb_index1 < bb_index2 ? -1 : 1; - /* Different group IDs lead never belong to the same group. */ if (dra_pair.second != drb_pair.second) return dra_pair.second < drb_pair.second ? -1 : 1; @@ -2967,7 +2961,13 @@ vect_analyze_data_ref_accesses (vec_info *vinfo, datarefs_copy.create (datarefs.length ()); for (unsigned i = 0; i < datarefs.length (); i++) { - int group_id = dataref_groups ? (*dataref_groups)[i] : 0; + int group_id; + /* If the caller computed DR grouping use that, otherwise group by + basic blocks. */ + if (dataref_groups) + group_id = (*dataref_groups)[i]; + else + group_id = gimple_bb (DR_STMT (datarefs[i]))->index; datarefs_copy.quick_push (data_ref_pair (datarefs[i], group_id)); } datarefs_copy.qsort (dr_group_sort_cmp); @@ -3003,13 +3003,8 @@ vect_analyze_data_ref_accesses (vec_info *vinfo, matters we can push those to a worklist and re-iterate over them. The we can just skip ahead to the next DR here. */ - /* DRs in a different BBs should not be put into the same + /* DRs in a different DR group should not be put into the same interleaving group. */ - int bb_index1 = gimple_bb (DR_STMT (dra))->index; - int bb_index2 = gimple_bb (DR_STMT (drb))->index; - if (bb_index1 != bb_index2) - break; - if (dra_group_id != drb_group_id) break; diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index bae255e96d5..3d4e701c0d8 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -5138,6 +5138,8 @@ vect_slp_bbs (vec bbs) &dataref_groups, current_group)) ++current_group; } + /* New BBs always start a new DR group. */ + ++current_group; } return vect_slp_region (bbs, datarefs, &dataref_groups, insns);