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?
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?).

Reply via email to