Skip to content
Snippets Groups Projects
Commit b6237343 authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

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.
parent 9bac6639
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment