diff mbox series

Allow variable-sized temporary variables in gimplify.c

Message ID 87lgh319t8.fsf_-_@linaro.org
State Accepted
Commit 825010bb37db90c97c9409d3407c8538e3246577
Headers show
Series Allow variable-sized temporary variables in gimplify.c | expand

Commit Message

Richard Sandiford Jan. 12, 2018, 1:33 p.m. UTC
This is needed to build libgfortran for SVE.  The OpenMP code needs
to create temporary vector variables, and the variables will therefore
be variable-sized for SVE.  Earlier patches made such variables work.

Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
Also tested by comparing the before-and-after assembly output for at
least one target per CPU directory.  OK to install?

Thanks,
Richard


2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* gimplify.c (gimple_add_tmp_var_fn): Allow variables to have a
	poly_uint64 size, rather than requiring an unsigned HOST_WIDE_INT size.
	(gimple_add_tmp_var): Likewise.

Comments

Richard Biener Jan. 12, 2018, 1:58 p.m. UTC | #1
On Fri, Jan 12, 2018 at 2:33 PM, Richard Sandiford
<richard.sandiford@linaro.org> wrote:
> This is needed to build libgfortran for SVE.  The OpenMP code needs

> to create temporary vector variables, and the variables will therefore

> be variable-sized for SVE.  Earlier patches made such variables work.

>

> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.

> Also tested by comparing the before-and-after assembly output for at

> least one target per CPU directory.  OK to install?


Ok.

Richard.

> Thanks,

> Richard

>

>

> 2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>

>

> gcc/

>         * gimplify.c (gimple_add_tmp_var_fn): Allow variables to have a

>         poly_uint64 size, rather than requiring an unsigned HOST_WIDE_INT size.

>         (gimple_add_tmp_var): Likewise.

>

> Index: gcc/gimplify.c

> ===================================================================

> --- gcc/gimplify.c      2018-01-10 08:43:40.053367209 +0000

> +++ gcc/gimplify.c      2018-01-12 12:49:36.756892670 +0000

> @@ -702,7 +702,7 @@ gimple_add_tmp_var_fn (struct function *

>    /* Later processing assumes that the object size is constant, which might

>       not be true at this point.  Force the use of a constant upper bound in

>       this case.  */

> -  if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (tmp)))

> +  if (!tree_fits_poly_uint64_p (DECL_SIZE_UNIT (tmp)))

>      force_constant_size (tmp);

>

>    DECL_CONTEXT (tmp) = fn->decl;

> @@ -721,7 +721,7 @@ gimple_add_tmp_var (tree tmp)

>    /* Later processing assumes that the object size is constant, which might

>       not be true at this point.  Force the use of a constant upper bound in

>       this case.  */

> -  if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (tmp)))

> +  if (!tree_fits_poly_uint64_p (DECL_SIZE_UNIT (tmp)))

>      force_constant_size (tmp);

>

>    DECL_CONTEXT (tmp) = current_function_decl;
diff mbox series

Patch

Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c	2018-01-10 08:43:40.053367209 +0000
+++ gcc/gimplify.c	2018-01-12 12:49:36.756892670 +0000
@@ -702,7 +702,7 @@  gimple_add_tmp_var_fn (struct function *
   /* Later processing assumes that the object size is constant, which might
      not be true at this point.  Force the use of a constant upper bound in
      this case.  */
-  if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (tmp)))
+  if (!tree_fits_poly_uint64_p (DECL_SIZE_UNIT (tmp)))
     force_constant_size (tmp);
 
   DECL_CONTEXT (tmp) = fn->decl;
@@ -721,7 +721,7 @@  gimple_add_tmp_var (tree tmp)
   /* Later processing assumes that the object size is constant, which might
      not be true at this point.  Force the use of a constant upper bound in
      this case.  */
-  if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (tmp)))
+  if (!tree_fits_poly_uint64_p (DECL_SIZE_UNIT (tmp)))
     force_constant_size (tmp);
 
   DECL_CONTEXT (tmp) = current_function_decl;