omp-low.c (lower_omp_target): Set DECL_VALUE_EXPR of new_var even for the non-array case.

* omp-low.c (lower_omp_target) <case USE_DEVICE_PTR>: Set
	DECL_VALUE_EXPR of new_var even for the non-array case.  Look
	through DECL_VALUE_EXPR for expansion.

	* c-c++-common/goacc/use_device-1.c: New test.

From-SVN: r232804
This commit is contained in:
Jakub Jelinek 2016-01-25 22:34:06 +01:00 committed by Jakub Jelinek
parent a4ea172334
commit d902b330dc
4 changed files with 33 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2016-01-25 Jakub Jelinek <jakub@redhat.com>
* omp-low.c (lower_omp_target) <case USE_DEVICE_PTR>: Set
DECL_VALUE_EXPR of new_var even for the non-array case. Look
through DECL_VALUE_EXPR for expansion.
2016-01-25 Bernd Edlinger <bernd.edlinger@hotmail.de>
* config/mips/mips.c (mips_compute_frame_info): Skip re-computing

View File

@ -15878,6 +15878,14 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
SET_DECL_VALUE_EXPR (new_var, x);
DECL_HAS_VALUE_EXPR_P (new_var) = 1;
}
else
{
tree new_var = lookup_decl (var, ctx);
x = create_tmp_var_raw (TREE_TYPE (new_var), get_name (new_var));
gimple_add_tmp_var (x);
SET_DECL_VALUE_EXPR (new_var, x);
DECL_HAS_VALUE_EXPR_P (new_var) = 1;
}
break;
}
@ -16493,6 +16501,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
x = build_fold_addr_expr (v);
}
}
new_var = DECL_VALUE_EXPR (new_var);
x = fold_convert (TREE_TYPE (new_var), x);
gimplify_expr (&x, &new_body, NULL, is_gimple_val, fb_rvalue);
gimple_seq_add_stmt (&new_body,

View File

@ -1,3 +1,7 @@
2016-01-25 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/goacc/use_device-1.c: New test.
2016-01-25 Jeff Law <law@redhat.com>
PR tree-optimization/69196

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
void bar (float *, float *);
void
foo (float *x, float *y)
{
int n = 1 << 10;
#pragma acc data create(x[0:n]) copyout(y[0:n])
{
#pragma acc host_data use_device(x,y)
bar (x, y);
}
}