[PATCH] nvptx: do not assume that crtl->is_leaf is unset

Jakub Jelinek jakub@redhat.com
Fri Dec 16 17:07:00 GMT 2016


On Fri, Dec 16, 2016 at 07:48:01PM +0300, Alexander Monakov wrote:
> Until a recent change, crtl->is_leaf was initialized only during IRA startup.
> On NVPTX, register allocation is not done, so the backend asserts that this
> field is unset, and recomputes it unconditionally.
> 
> Now this field can be optionally set via ira_setup_eliminable_regset for
> register-pressure-sensitive optimizations, so the assumption in the backend no
> longer holds.  Remove the assert, but avoid recomputing the field if it is
> already set, indicating that the function is known to be leaf.
> 
> OK to apply?
> 
> Thanks.
> Alexander
> 
> 	PR target/78831
> 	* config/nvptx/nvptx.c (init_softstack_frame): Remove assert.  Compute
> 	crtl->is_leaf only if unset.  Adjust comment.

LGTM, but please give Bernd a few days to chime in.

> diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
> index 17fe551..b3f025f 100644
> --- a/gcc/config/nvptx/nvptx.c
> +++ b/gcc/config/nvptx/nvptx.c
> @@ -1048,9 +1048,10 @@ init_softstack_frame (FILE *file, unsigned alignment, HOST_WIDE_INT size)
>            bits, reg_stack, reg_frame, size);
> 
>    /* Usually 'crtl->is_leaf' is computed during register allocator
> -     initialization, which is not done on NVPTX.  Compute it now.  */
> -  gcc_assert (!crtl->is_leaf);
> -  crtl->is_leaf = leaf_function_p ();
> +     initialization (which is not done on NVPTX) or for pressure-sensitive
> +     optimizations.  Initialize it here, except if already set.  */
> +  if (!crtl->is_leaf)
> +    crtl->is_leaf = leaf_function_p ();
>    if (!crtl->is_leaf)
>      fprintf (file, "\t\tst.shared.u%d [%s], %s;\n",
>              bits, reg_sspslot, reg_stack);

	Jakub



More information about the Gcc-patches mailing list