diff mbox

[PR,70857] Copy RESULT_DECL of HSA outlined kernel function

Message ID 20160516142510.GM5580@virgil.suse.cz
State New
Headers show

Commit Message

Martin Jambor May 16, 2016, 2:25 p.m. UTC
Hi,

the patch below fixes PR 70857.  When the HSA gridification code
copies the declaration of the function for outlining the target
construct, it left the old RESULT_DECL dangling to it.  I did not
notice because it has VOID_TYPE but it needs to be done nevertheless,
not least because ipa-pta chokes on it.

Bootstrapped and tested on x86_64 with hsa enabled.  OK for trunk and
the gcc-6 branch?

Thanks,

Martin

2016-05-12  Martin Jambor  <mjambor@suse.cz>

	PR hsa/70857
	* omp-low.c (grid_expand_target_grid_body): Copy RESULT_DECL of
	the outlined kernel function.
---
 gcc/omp-low.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jakub Jelinek May 16, 2016, 2:26 p.m. UTC | #1
On Mon, May 16, 2016 at 04:25:10PM +0200, Martin Jambor wrote:
> the patch below fixes PR 70857.  When the HSA gridification code
> copies the declaration of the function for outlining the target
> construct, it left the old RESULT_DECL dangling to it.  I did not
> notice because it has VOID_TYPE but it needs to be done nevertheless,
> not least because ipa-pta chokes on it.
> 
> Bootstrapped and tested on x86_64 with hsa enabled.  OK for trunk and
> the gcc-6 branch?
> 
> Thanks,
> 
> Martin
> 
> 2016-05-12  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR hsa/70857
> 	* omp-low.c (grid_expand_target_grid_body): Copy RESULT_DECL of
> 	the outlined kernel function.

Ok.

> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index c9600fb..a11f44b 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -13681,6 +13681,9 @@ grid_expand_target_grid_body (struct omp_region *target)
>    tree new_parm_decl = copy_node (DECL_ARGUMENTS (kern_fndecl));
>    DECL_CONTEXT (new_parm_decl) = kern_fndecl;
>    DECL_ARGUMENTS (kern_fndecl) = new_parm_decl;
> +  gcc_assert (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (kern_fndecl))));
> +  DECL_RESULT (kern_fndecl) = copy_node (DECL_RESULT (kern_fndecl));
> +  DECL_CONTEXT (DECL_RESULT (kern_fndecl)) = kern_fndecl;
>    struct function *kern_cfun = DECL_STRUCT_FUNCTION (kern_fndecl);
>    kern_cfun->curr_properties = cfun->curr_properties;
>  
> -- 
> 2.8.2

	Jakub
diff mbox

Patch

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index c9600fb..a11f44b 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -13681,6 +13681,9 @@  grid_expand_target_grid_body (struct omp_region *target)
   tree new_parm_decl = copy_node (DECL_ARGUMENTS (kern_fndecl));
   DECL_CONTEXT (new_parm_decl) = kern_fndecl;
   DECL_ARGUMENTS (kern_fndecl) = new_parm_decl;
+  gcc_assert (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (kern_fndecl))));
+  DECL_RESULT (kern_fndecl) = copy_node (DECL_RESULT (kern_fndecl));
+  DECL_CONTEXT (DECL_RESULT (kern_fndecl)) = kern_fndecl;
   struct function *kern_cfun = DECL_STRUCT_FUNCTION (kern_fndecl);
   kern_cfun->curr_properties = cfun->curr_properties;