Hi, PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95570 Here, we are doing loop versioning for alignment. The only dr here is a gather-statter operation: x[start][i]. Scalar evolution analysis for this dr failed, so DR_STEP is NULL_TREE, which leads to the segfault. But scatter-gather operation should be filtered out in vect_enhance_data_refs_alignment. There are similar issues in vect_verify_datarefs_alignment, vect_get_peeling_costs_all_drs and vect_peeling_supportable. Proposed patch adds back the necessary tests. Bootstrapped and tested on aarch64-linux-gnu & x86_64-linux-gnu.
Test coverage: Existing tests [1] and newly added test ensures coverage for all the changes except for the changes in vect_peeling_supportable. Currently I don't have a test to cover the changes in vect_peeling_supportable. Should we keep them? Thanks, Felix gcc: +2020-06-10 Felix Yang <felix.y...@huawei.com> + + PR tree-optimization/95570 + * tree-vect-data-refs.c (vect_verify_datarefs_alignment): Filter + out gather-scatter and invariant accesses when iterating over all + data references. + (vect_get_peeling_costs_all_drs): Likewise. + (vect_peeling_supportable): Likewise, and filter out irrelevant data + references. + (vect_enhance_data_refs_alignment): Likewise when checking if + versioning for alignment is needed. gcc/testsuite: +2020-06-10 Felix Yang <felix.y...@huawei.com> + + PR tree-optimization/95570 + * gcc.dg/vect/pr95570.c: New test. [1] gcc.dg/pr50133.c gcc.dg/vect/pr49771.c gcc.dg/pr87894.c gcc.dg/vect/bb-slp-42.c gcc.target/aarch64/sve/mask_gather_load_1.c
pr95570-v1.diff
Description: pr95570-v1.diff