From: Richard Sandiford Date: Fri, 2 Mar 2018 09:45:51 +0000 (+0000) Subject: Use loop->safelen rather than loop->force_vectorize X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=962e91fcf043edab3684dd0564efd3df219d3cb1;p=gcc.git Use loop->safelen rather than loop->force_vectorize ...since the latter doesn't guarantee independence by itself. 2018-03-02 Richard Sandiford gcc/ * tree-vect-data-refs.c (vect_analyze_data_ref_dependence) (vect_analyze_data_ref_access): Use loop->safe_len rather than loop->force_vectorize to check whether there is no alias. gcc/testsuite/ * gcc.dg/vect/vect-alias-check-13.c: New test. From-SVN: r258130 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09cae39cc27..affd19a94bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-02 Richard Sandiford + + * tree-vect-data-refs.c (vect_analyze_data_ref_dependence) + (vect_analyze_data_ref_access): Use loop->safe_len rather than + loop->force_vectorize to check whether there is no alias. + 2018-03-02 Jakub Jelinek PR target/84614 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cb19be5925b..e15927ca90e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-03-02 Richard Sandiford + + * gcc.dg/vect/vect-alias-check-13.c: New test. + 2018-03-02 Jakub Jelinek PR target/84614 diff --git a/gcc/testsuite/gcc.dg/vect/vect-alias-check-13.c b/gcc/testsuite/gcc.dg/vect/vect-alias-check-13.c new file mode 100644 index 00000000000..60bc4730724 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-alias-check-13.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +void +f1 (int *x, long step1, int n) +{ + for (int i = 0; i < n; ++i) + x[i * step1] += 1; +} + +void +f2 (int *x, long step2, int n) +{ +#pragma GCC ivdep + for (int i = 0; i < n; ++i) + x[i * step2] += 2; +} + +/* { dg-final { scan-tree-dump {need run-time check that [^\n]*step1[^\n]* is nonzero} "vect" } } */ +/* { dg-final { scan-tree-dump-not {need run-time check that [^\n]*step2[^\n]* is nonzero} "vect" } } */ +/* { dg-final { scan-tree-dump-times {LOOP VECTORIZED} 2 "vect" } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 01f7138e077..c0094989c7b 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -466,7 +466,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, return true; } - if (!loop->force_vectorize) + if (loop->safelen < 2) { tree indicator = dr_zero_step_indicator (dra); if (TREE_CODE (indicator) != INTEGER_CST) @@ -2720,7 +2720,7 @@ vect_analyze_data_ref_access (struct data_reference *dr) /* Allow references with zero step for outer loops marked with pragma omp simd only - it guarantees absence of loop-carried dependencies between inner loop iterations. */ - if (!loop->force_vectorize) + if (loop->safelen < 2) { if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location,