public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Don't treat variable-length vectors as VLAs during gimplification
@ 2019-09-18  6:53 Richard Sandiford
  2019-09-18  8:56 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2019-09-18  6:53 UTC (permalink / raw)
  To: gcc-patches

Source-level SVE vectors should be gimplified in the same way
as normal fixed-length vectors rather than as VLAs.

This is tested by later SVE patches.

Tested on aarch64-linux-gnu with SVE (with and without follow-on
patches) and x86_64-linux-gnu.  OK to install?

Richard


2019-09-18  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* gimplify.c (gimplify_decl_expr): Use poly_int_tree_p instead
	of checking specifically for INTEGER_CST.

Index: gcc/gimplify.c
===================================================================
--- gcc/gimplify.c	2019-08-08 18:11:51.411313290 +0100
+++ gcc/gimplify.c	2019-09-18 07:52:22.799034800 +0100
@@ -1754,11 +1754,12 @@ gimplify_decl_expr (tree *stmt_p, gimple
       tree init = DECL_INITIAL (decl);
       bool is_vla = false;
 
-      if (TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST
+      poly_uint64 size;
+      if (!poly_int_tree_p (DECL_SIZE_UNIT (decl), &size)
 	  || (!TREE_STATIC (decl)
 	      && flag_stack_check == GENERIC_STACK_CHECK
-	      && compare_tree_int (DECL_SIZE_UNIT (decl),
-				   STACK_CHECK_MAX_VAR_SIZE) > 0))
+	      && maybe_gt (size,
+			   (unsigned HOST_WIDE_INT) STACK_CHECK_MAX_VAR_SIZE)))
 	{
 	  gimplify_vla_decl (decl, seq_p);
 	  is_vla = true;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Don't treat variable-length vectors as VLAs during gimplification
  2019-09-18  6:53 Don't treat variable-length vectors as VLAs during gimplification Richard Sandiford
@ 2019-09-18  8:56 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2019-09-18  8:56 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: GCC Patches

On Wed, Sep 18, 2019 at 8:53 AM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> Source-level SVE vectors should be gimplified in the same way
> as normal fixed-length vectors rather than as VLAs.
>
> This is tested by later SVE patches.
>
> Tested on aarch64-linux-gnu with SVE (with and without follow-on
> patches) and x86_64-linux-gnu.  OK to install?

OK.

Richard.

> Richard
>
>
> 2019-09-18  Richard Sandiford  <richard.sandiford@arm.com>
>
> gcc/
>         * gimplify.c (gimplify_decl_expr): Use poly_int_tree_p instead
>         of checking specifically for INTEGER_CST.
>
> Index: gcc/gimplify.c
> ===================================================================
> --- gcc/gimplify.c      2019-08-08 18:11:51.411313290 +0100
> +++ gcc/gimplify.c      2019-09-18 07:52:22.799034800 +0100
> @@ -1754,11 +1754,12 @@ gimplify_decl_expr (tree *stmt_p, gimple
>        tree init = DECL_INITIAL (decl);
>        bool is_vla = false;
>
> -      if (TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST
> +      poly_uint64 size;
> +      if (!poly_int_tree_p (DECL_SIZE_UNIT (decl), &size)
>           || (!TREE_STATIC (decl)
>               && flag_stack_check == GENERIC_STACK_CHECK
> -             && compare_tree_int (DECL_SIZE_UNIT (decl),
> -                                  STACK_CHECK_MAX_VAR_SIZE) > 0))
> +             && maybe_gt (size,
> +                          (unsigned HOST_WIDE_INT) STACK_CHECK_MAX_VAR_SIZE)))
>         {
>           gimplify_vla_decl (decl, seq_p);
>           is_vla = true;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-18  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18  6:53 Don't treat variable-length vectors as VLAs during gimplification Richard Sandiford
2019-09-18  8:56 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).