Don't treat variable-length vectors as VLAs during gimplification
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 18 Sep 2019 09:43:42 +0000 (09:43 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 18 Sep 2019 09:43:42 +0000 (09:43 +0000)
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.

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.

From-SVN: r275870

gcc/ChangeLog
gcc/gimplify.c

index 3afdb09f0726bbc03d403a5bcfa93b984f0caac8..2842a7f4cfc7a07dd7aec78323bc79587aaa673d 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-18  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * gimplify.c (gimplify_decl_expr): Use poly_int_tree_p instead
+       of checking specifically for INTEGER_CST.
+
 2019-09-18  Richard Sandiford  <richard.sandiford@arm.com>
 
        * stor-layout.c (compute_record_mode): Operate on poly_uint64
index daa0b71c191e6d92387180e927b818517b8b58a7..623cdbfed7c758611466a2955c047ad3b6abf936 100644 (file)
@@ -1754,11 +1754,12 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
       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;