From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 79D173861962; Thu, 9 Jul 2020 11:22:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79D173861962 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594293771; bh=XbCQozAilJwQzRGD5OJlWr53AKNwe6YqLtm7RH1Wf+k=; h=From:To:Subject:Date:From; b=mGRBld51YSSfujw5lYmY0u6jWKfLydTDWXhvnfdfFxNdXBCRMDEzYdSyLKC1bEdM+ 7mT1L2f4EbXt9iWyhZAJMWHy31GMKXa47QoQQc6t+DxMR3uoMZRPx3X+nlPa52l2TV sRzD54tSIhTA47KjL9ppvSLXSzuosB2QmkL5rnOo= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-1969] remove premature vect_verify_datarefs_alignment X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: dd21b03900085c4d60bf03207ad28bcbfbc86a4b X-Git-Newrev: a1e25d0008791118dd58eaddff5f4c3691f8750e Message-Id: <20200709112251.79D173861962@sourceware.org> Date: Thu, 9 Jul 2020 11:22:51 +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: Thu, 09 Jul 2020 11:22:51 -0000 https://gcc.gnu.org/g:a1e25d0008791118dd58eaddff5f4c3691f8750e commit r11-1969-ga1e25d0008791118dd58eaddff5f4c3691f8750e Author: Richard Biener Date: Wed Jul 8 16:37:55 2020 +0200 remove premature vect_verify_datarefs_alignment This followup removes vect_verify_datarefs_alignment and its premature cancellation of vectorization leaving the actual decision whether alignment is supported to the functions deciding whether we can vectorize a load or store. 2020-07-08 Richard Biener * tree-vectorizer.h (vect_verify_datarefs_alignment): Remove. (vect_slp_analyze_and_verify_instance_alignment): Rename to ... (vect_slp_analyze_instance_alignment): ... this. * tree-vect-data-refs.c (verify_data_ref_alignment): Remove. (vect_verify_datarefs_alignment): Likewise. (vect_enhance_data_refs_alignment): Do not call vect_verify_datarefs_alignment. (vect_slp_analyze_node_alignment): Rename from vect_slp_analyze_and_verify_node_alignment and do not call verify_data_ref_alignment. (vect_slp_analyze_instance_alignment): Rename from vect_slp_analyze_and_verify_instance_alignment. * tree-vect-stmts.c (vectorizable_store): Dump when we vectorize an unaligned access. (vectorizable_load): Likewise. * tree-vect-loop.c (vect_analyze_loop_2): Do not call vect_verify_datarefs_alignment. * tree-vect-slp.c (vect_slp_analyze_bb_1): Adjust. * gcc.dg/vect/bb-slp-10.c: Adjust. * gcc.dg/vect/slp-45.c: Likewise. * gcc.dg/vect/vect-109.c: Likewise. Diff: --- gcc/testsuite/gcc.dg/vect/bb-slp-10.c | 2 +- gcc/testsuite/gcc.dg/vect/slp-45.c | 3 +- gcc/testsuite/gcc.dg/vect/vect-109.c | 2 +- gcc/tree-vect-data-refs.c | 88 ++++------------------------------- gcc/tree-vect-loop.c | 2 - gcc/tree-vect-slp.c | 2 +- gcc/tree-vect-stmts.c | 14 ++++++ gcc/tree-vectorizer.h | 4 +- 8 files changed, 28 insertions(+), 89 deletions(-) diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-10.c b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c index 1f9b917dcd2..ad6f878e407 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-10.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-10.c @@ -49,6 +49,6 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump "bad data alignment in basic block" "slp2" { target { ! vect_element_align } } } } */ +/* { dg-final { scan-tree-dump "unsupported unaligned access" "slp2" { target { ! vect_element_align } } } } */ /* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { target vect_element_align } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-45.c b/gcc/testsuite/gcc.dg/vect/slp-45.c index d83472ca095..1e35d354203 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-45.c +++ b/gcc/testsuite/gcc.dg/vect/slp-45.c @@ -77,5 +77,4 @@ int main() return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 13 "vect" { target vect_hw_misalign } } } */ -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { ! vect_hw_misalign } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 13 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-109.c b/gcc/testsuite/gcc.dg/vect/vect-109.c index ac5d0827899..fe7ea6c420f 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-109.c +++ b/gcc/testsuite/gcc.dg/vect/vect-109.c @@ -77,6 +77,6 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_element_align } } } */ -/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" { xfail vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "unsupported unaligned access" 2 "vect" { xfail vect_element_align } } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align xfail { ! vect_unaligned_possible } } } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 2b4421b5fb4..e35a215e042 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1214,56 +1214,6 @@ vect_relevant_for_alignment_p (dr_vec_info *dr_info) return true; } -/* Function verify_data_ref_alignment - - Return TRUE if DR_INFO can be handled with respect to alignment. */ - -static opt_result -verify_data_ref_alignment (vec_info *vinfo, dr_vec_info *dr_info) -{ - enum dr_alignment_support supportable_dr_alignment - = vect_supportable_dr_alignment (vinfo, dr_info, false); - if (!supportable_dr_alignment) - return opt_result::failure_at - (dr_info->stmt->stmt, - DR_IS_READ (dr_info->dr) - ? "not vectorized: unsupported unaligned load: %T\n" - : "not vectorized: unsupported unaligned store: %T\n", - DR_REF (dr_info->dr)); - - if (supportable_dr_alignment != dr_aligned && dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, vect_location, - "Vectorizing an unaligned access.\n"); - - return opt_result::success (); -} - -/* Function vect_verify_datarefs_alignment - - Return TRUE if all data references in the loop can be - handled with respect to alignment. */ - -opt_result -vect_verify_datarefs_alignment (loop_vec_info loop_vinfo) -{ - vec datarefs = LOOP_VINFO_DATAREFS (loop_vinfo); - struct data_reference *dr; - unsigned int i; - - FOR_EACH_VEC_ELT (datarefs, i, dr) - { - dr_vec_info *dr_info = loop_vinfo->lookup_dr (dr); - if (!vect_relevant_for_alignment_p (dr_info)) - continue; - - opt_result res = verify_data_ref_alignment (loop_vinfo, dr_info); - if (!res) - return res; - } - - return opt_result::success (); -} - /* Given an memory reference EXP return whether its alignment is less than its size. */ @@ -2091,13 +2041,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) /* Check if all datarefs are supportable and log. */ if (do_peeling && known_alignment_for_access_p (dr0_info) && npeel == 0) - { - opt_result stat = vect_verify_datarefs_alignment (loop_vinfo); - if (!stat) - do_peeling = false; - else - return stat; - } + return opt_result::success (); /* Cost model #1 - honor --param vect-max-peeling-for-alignment. */ if (do_peeling) @@ -2186,9 +2130,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) /* The inside-loop cost will be accounted for in vectorizable_load and vectorizable_store correctly with adjusted alignments. Drop the body_cst_vec on the floor here. */ - opt_result stat = vect_verify_datarefs_alignment (loop_vinfo); - gcc_assert (stat); - return stat; + return opt_result::success (); } } @@ -2318,16 +2260,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) /* Peeling and versioning can't be done together at this time. */ gcc_assert (! (do_peeling && do_versioning)); - opt_result stat = vect_verify_datarefs_alignment (loop_vinfo); - gcc_assert (stat); - return stat; + return opt_result::success (); } /* This point is reached if neither peeling nor versioning is being done. */ gcc_assert (! (do_peeling || do_versioning)); - opt_result stat = vect_verify_datarefs_alignment (loop_vinfo); - return stat; + return opt_result::success (); } @@ -2431,7 +2370,7 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo) /* Analyze alignment of DRs of stmts in NODE. */ static bool -vect_slp_analyze_and_verify_node_alignment (vec_info *vinfo, slp_tree node) +vect_slp_analyze_node_alignment (vec_info *vinfo, slp_tree node) { /* We vectorize from the first scalar stmt in the node unless the node is permuted in which case we start from the first @@ -2457,15 +2396,6 @@ vect_slp_analyze_and_verify_node_alignment (vec_info *vinfo, slp_tree node) vect_compute_data_ref_alignment (vinfo, first_dr_info); } - if (! verify_data_ref_alignment (vinfo, dr_info)) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "not vectorized: bad data alignment in basic " - "block.\n"); - return false; - } - return true; } @@ -2475,20 +2405,20 @@ vect_slp_analyze_and_verify_node_alignment (vec_info *vinfo, slp_tree node) Return FALSE if a data reference is found that cannot be vectorized. */ bool -vect_slp_analyze_and_verify_instance_alignment (vec_info *vinfo, +vect_slp_analyze_instance_alignment (vec_info *vinfo, slp_instance instance) { - DUMP_VECT_SCOPE ("vect_slp_analyze_and_verify_instance_alignment"); + DUMP_VECT_SCOPE ("vect_slp_analyze_instance_alignment"); slp_tree node; unsigned i; FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), i, node) - if (! vect_slp_analyze_and_verify_node_alignment (vinfo, node)) + if (! vect_slp_analyze_node_alignment (vinfo, node)) return false; node = SLP_INSTANCE_TREE (instance); if (STMT_VINFO_DATA_REF (SLP_TREE_REPRESENTATIVE (node)) - && ! vect_slp_analyze_and_verify_node_alignment + && ! vect_slp_analyze_node_alignment (vinfo, SLP_INSTANCE_TREE (instance))) return false; diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index fb56ca48b68..6ec16475c66 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2136,8 +2136,6 @@ start_over: /* This pass will decide on using loop versioning and/or loop peeling in order to enhance the alignment of data references in the loop. */ ok = vect_enhance_data_refs_alignment (loop_vinfo); - else - ok = vect_verify_datarefs_alignment (loop_vinfo); if (!ok) return ok; diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 33fc87a9f86..35ae6984593 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -3289,7 +3289,7 @@ vect_slp_analyze_bb_1 (bb_vec_info bb_vinfo, int n_stmts, bool &fatal) dependence in the SLP instances. */ for (i = 0; BB_VINFO_SLP_INSTANCES (bb_vinfo).iterate (i, &instance); ) { - if (! vect_slp_analyze_and_verify_instance_alignment (bb_vinfo, instance) + if (! vect_slp_analyze_instance_alignment (bb_vinfo, instance) || ! vect_slp_analyze_instance_dependence (bb_vinfo, instance)) { slp_tree node = SLP_INSTANCE_TREE (instance); diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 5eae74e8042..6730cae8085 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -7190,6 +7190,13 @@ vectorizable_store (vec_info *vinfo, return false; } + if (dump_enabled_p () + && memory_access_type != VMAT_ELEMENTWISE + && memory_access_type != VMAT_GATHER_SCATTER + && alignment_support_scheme != dr_aligned) + dump_printf_loc (MSG_NOTE, vect_location, + "Vectorizing an unaligned access.\n"); + STMT_VINFO_TYPE (stmt_info) = store_vec_info_type; vect_model_store_cost (vinfo, stmt_info, ncopies, memory_access_type, vls_type, slp_node, cost_vec); @@ -8475,6 +8482,13 @@ vectorizable_load (vec_info *vinfo, group_size, memory_access_type, &gs_info, mask); + if (dump_enabled_p () + && memory_access_type != VMAT_ELEMENTWISE + && memory_access_type != VMAT_GATHER_SCATTER + && alignment_support_scheme != dr_aligned) + dump_printf_loc (MSG_NOTE, vect_location, + "Vectorizing an unaligned access.\n"); + STMT_VINFO_TYPE (orig_stmt_info) = load_vec_info_type; vect_model_load_cost (vinfo, stmt_info, ncopies, vf, memory_access_type, slp_node, cost_vec); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 7c6de8397b3..91d3291ab56 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -1892,9 +1892,7 @@ extern opt_result vect_analyze_data_ref_dependences (loop_vec_info, unsigned int extern bool vect_slp_analyze_instance_dependence (vec_info *, slp_instance); extern opt_result vect_enhance_data_refs_alignment (loop_vec_info); extern opt_result vect_analyze_data_refs_alignment (loop_vec_info); -extern opt_result vect_verify_datarefs_alignment (loop_vec_info); -extern bool vect_slp_analyze_and_verify_instance_alignment (vec_info *, - slp_instance); +extern bool vect_slp_analyze_instance_alignment (vec_info *, slp_instance); extern opt_result vect_analyze_data_ref_accesses (vec_info *); extern opt_result vect_prune_runtime_alias_test_list (loop_vec_info); extern bool vect_gather_scatter_fn_p (vec_info *, bool, bool, tree, tree,