https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63844
--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 18 Nov 2014, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63844 > > --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > (In reply to Richard Biener from comment #9) > > Valid testcase (well, assign sth useful to g...) > > > > #define N 10000000 > > int a[N], b[N], c[N]; > > > > main() > > { > > > > int i, g; > > > > #pragma omp parallel for num_threads(4) > > for (i = 0; i < N; i++) { > > a[i] = b[i] + c[i] + g; > > } > > } > > > > in the OMP fn we fail to hoist the load of .omp_child_i->g out of the > > loop and thus generate inferior code. > > And does making receiver_decl restrict and/or reference type help with that? Yes. > BTW, we probably should add some IPA omp pass that would try to constant > propagate across from GOMP_parallel*/GOMP_task* callers to the *.omp_fn.* > functions (or teach IPA-SRA to do that?). I think aggregate IPA-CP does that, IPA-SRA cannot as the function has its address taken. Richard.