aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-06-23 12:43:03 +0200
committerRichard Biener <rguenther@suse.de>2021-06-24 09:07:05 +0200
commit50374fdacbd121bc4a61b073e559208ff61bee06 (patch)
tree803bc4ed31c46913877ae542f8dc58561347e83c /gcc/tree-vect-data-refs.c
parent3bd86940c428de9dde53e41265fb1435ed236f5e (diff)
downloadgcc-50374fdacbd121bc4a61b073e559208ff61bee06.zip
gcc-50374fdacbd121bc4a61b073e559208ff61bee06.tar.gz
gcc-50374fdacbd121bc4a61b073e559208ff61bee06.tar.bz2
tree-optimization/101105 - fix runtime alias test optimization
We were ignoring DR_STEP for VF == 1 which is OK only in case the scalar order is preserved or both DR steps are the same. 2021-06-23 Richard Biener <rguenther@suse.de> PR tree-optimization/101105 * tree-vect-data-refs.c (vect_prune_runtime_alias_test_list): Only ignore steps when they are equal or scalar order is preserved. * gcc.dg/torture/pr101105.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index be067c8..579149d 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -3479,9 +3479,9 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
/* Step values are irrelevant for aliasing if the number of vector
iterations is equal to the number of scalar iterations (which can
happen for fully-SLP loops). */
- bool ignore_step_p = known_eq (LOOP_VINFO_VECT_FACTOR (loop_vinfo), 1U);
+ bool vf_one_p = known_eq (LOOP_VINFO_VECT_FACTOR (loop_vinfo), 1U);
- if (!ignore_step_p)
+ if (!vf_one_p)
{
/* Convert the checks for nonzero steps into bound tests. */
tree value;
@@ -3534,6 +3534,11 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
bool preserves_scalar_order_p
= vect_preserves_scalar_order_p (dr_info_a, dr_info_b);
+ bool ignore_step_p
+ = (vf_one_p
+ && (preserves_scalar_order_p
+ || operand_equal_p (DR_STEP (dr_info_a->dr),
+ DR_STEP (dr_info_b->dr))));
/* Skip the pair if inter-iteration dependencies are irrelevant
and intra-iteration dependencies are guaranteed to be honored. */