[OpenACC privatization, nvptx] Tighten some aspects [PR90115]

No functional change.

	gcc/
	PR middle-end/90115
	* config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl)
	(nvptx_goacc_expand_var_decl): Tighten.
This commit is contained in:
Thomas Schwinge 2021-05-20 15:08:38 +02:00
parent 29a2f51806
commit f6f45309d9

View file

@ -6682,12 +6682,12 @@ nvptx_truly_noop_truncation (poly_uint64, poly_uint64)
static tree static tree
nvptx_goacc_adjust_private_decl (tree decl, int level) nvptx_goacc_adjust_private_decl (tree decl, int level)
{ {
if (level != GOMP_DIM_GANG) gcc_checking_assert (!lookup_attribute ("oacc gang-private",
return decl; DECL_ATTRIBUTES (decl)));
/* Set "oacc gang-private" attribute for gang-private variable /* Set "oacc gang-private" attribute for gang-private variable
declarations. */ declarations. */
if (!lookup_attribute ("oacc gang-private", DECL_ATTRIBUTES (decl))) if (level == GOMP_DIM_GANG)
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
@ -6708,9 +6708,10 @@ static rtx
nvptx_goacc_expand_var_decl (tree var) nvptx_goacc_expand_var_decl (tree var)
{ {
/* Place "oacc gang-private" variables in shared memory. */ /* Place "oacc gang-private" variables in shared memory. */
if (VAR_P (var) if (lookup_attribute ("oacc gang-private", DECL_ATTRIBUTES (var)))
&& lookup_attribute ("oacc gang-private", DECL_ATTRIBUTES (var)))
{ {
gcc_checking_assert (VAR_P (var));
unsigned int offset, *poffset; unsigned int offset, *poffset;
poffset = gang_private_shared_hmap.get (var); poffset = gang_private_shared_hmap.get (var);
if (poffset) if (poffset)