https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70729
--- Comment #34 from Yuri Rumyantsev <ysrumyan at gmail dot com> --- Thanks a lot Jakub for your detail comments. I have simple fix which cures failures from 71734. The fix is simple enough and simply check that the ref in problem belongs to simd loop: diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index ee04826..c710bbe 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -2128,7 +2128,7 @@ ref_indep_loop_p_1 (struct loop *loop, im_mem_ref *ref, if (bitmap_bit_p (refs_to_check, UNANALYZABLE_MEM_ID)) return false; - if (loop->safelen > 0) + if (loop->safelen > 1 && bitmap_bit_p (refs_to_check, ref->id)) { if (dump_file && (dump_flags & TDF_DETAILS)) { and I checked that simd3.f90 and simd4.f90 from libgomp.fortran passed with it. 2016-07-04 18:30 GMT+03:00 jakub at gcc dot gnu.org <gcc-bugzi...@gcc.gnu.org>: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70729 > > --- Comment #33 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > In any case, loop->safelen > 0 test looks also wrong, if there are guarantees > about single iteration only (safelen(1)), then there is nothing useful at all. > So it must be loop->safelen >= 2. > > For foo in #c29, the q[0] load in foo can be hoisted before the loop. > More complicated is e.g.: > void baz (int *p, int *q, int *r, int *s) > { > #pragma omp simd > for (int i = 0; i < 1024; i++) > { > p[i] += q[0] * 6; > r[i] += s[0] * 9; > } > } > Here IMNSHO only q[0] * 6 can be hoisted before the loop, while it can alias > p[1023] (or for x < 1023 p[x] if p[x] is initially 0), p[1023] could validly > alias s[0] and thus s[0] * 9 must not be hoisted. > > -- > You are receiving this mail because: > You reported the bug.