openmp: Fix up handling of addressable temporaries in simd lb, b and incr expressions [PR98383]
For simd, we have code to artificially add locally defined variables into private clauses if they are addressable, so that omplower turns them into "omp simd array" variables. As the testcase shows, this is undesirable if those temporaries only show in the lb, b or incr expressions and nowhere else, if it is just used there, we really want normal scalar temporaries. This patch implements that by making sure we don't set for those GOVD_LOCAL-ish temporaries turned into GOVD_PRIVATE the GOVD_SEEN flag during gimplification of the lb, b and incr expressions, which means that the private clause isn't added for those. 2020-12-21 Jakub Jelinek <jakub@redhat.com> PR c++/98383 * gimplify.c (struct gimplify_omp_ctx): Add in_for_exprs flag. (gimple_add_tmp_var): For addressable temporaries appearing in simd lb, b or incr expressions, don't add a private clause unless it is seen also outside of those expressions in the simd body. (omp_notice_variable): Likewise. (gimplify_omp_for): Set and reset in_for_exprs around gimplification of lb, b or incr expressions. * g++.dg/gomp/pr98383.C: New test.
Loading
Please register or sign in to comment