]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Change the 3rd parameter of function .DEFERRED_INIT from IS_VLA to decl name.
authorQing Zhao <qing.zhao@oracle.com>
Tue, 11 Jan 2022 23:18:13 +0000 (23:18 +0000)
committerQing Zhao <qing.zhao@oracle.com>
Tue, 11 Jan 2022 23:18:13 +0000 (23:18 +0000)
Currently, the 3rd parameter of function .DEFERRED_INIT is IS_VLA, which is
not needed at all;

In this patch, we change the 3rd parameter from IS_VLA to the name of the var
decl for the following purposes:

1. Fix (or work around) PR103720:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103720

As confirmed in PR103720, with the current definition of .DEFERRED_INIT,

Dom transformed:
  c$a$0_6 = .DEFERRED_INIT (8, 2, 0);
  _1 = .DEFERRED_INIT (8, 2, 0);

into:
  c$a$0_6 = .DEFERRED_INIT (8, 2, 0);
  _1 = c$a$0_6;

which is incorrectly done due to Dom treating the two calls to const function
.DEFERRED_INIT as the same call since all actual parameters are the same.

The same issue has been exposed in PR102608 due to a different optimization VN,
the fix for PR102608 is to specially handle call to .DEFERRED_INIT in VN to
exclude it from CSE.

To fix PR103720, we could do the same as the fix to PR102608 to specially
handle call to .DEFERRED_INIT in Dom to exclude it from being optimized.

However, in addition to Dom and VN, there should be other optimizations that
have the same issue as PR103720 or PR102608 (As I built Linux kernel with
-ftrivial-auto-var-init=zero -Werror, I noticed a bunch of bugos warnings).

Other than identifying all the optimizations and specially handling call to
.DEFERRED_INIT in all these optimizations, changing the 3rd parameter of the
function .DEFERRED_INIT from IS_VLA to the name string of the var decl might
be a better workaround (or a fix). After this change, since the 3rd actual
parameter is the name string of the variable, different calls for different
variables will have different name strings as the 3rd actual, As a result, the
optimization that previously treated the different calls to .DEFERRED_INIT as
the same will be prevented.

2. Prepare for enabling -Wuninitialized + -ftrivail-auto-var-init for address
taken variables.

As discussion in the following thread:

https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577431.html

With the current implemenation of -ftrivial-auto-var-init and uninitialized
warning analysis, the uninitialized warning for an address taken auto variable
might be missed since the variable is completely eliminated by optimization and
replaced with a temporary variable in all the uses.

In order to improve such situation, changing the 3rd parameter of the function
.DEFERRED_INIT to the name string of the variable will provide necessary
information to uninitialized warning analysis to make the missing warning
possible.

gcc/ChangeLog:

2022-01-11  qing zhao  <qing.zhao@oracle.com>

* gimplify.c (gimple_add_init_for_auto_var): Delete the 3rd argument.
Change the 3rd argument of function .DEFERRED_INIT to the name of the
decl.
(gimplify_decl_expr): Delete the 3rd argument when call
gimple_add_init_for_auto_var.
* internal-fn.c (expand_DEFERRED_INIT): Update comments to reflect
the 3rd argument change of function .DEFERRED_INIT.
* tree-cfg.c (verify_gimple_call): Update comments and verification
to reflect the 3rd argument change of function .DEFERRED_INIT.
* tree-sra.c (generate_subtree_deferred_init): Delete the 3rd argument.
(sra_modify_deferred_init): Change the 3rd argument of function
.DEFERRED_INIT to the name of the decl.

gcc/testsuite/ChangeLog:

2022-01-11  qing zhao  <qing.zhao@oracle.com>

* c-c++-common/auto-init-1.c: Adjust testcase to reflect the 3rd
argument change of function .DEFERRED_INIT.
* c-c++-common/auto-init-10.c: Likewise.
* c-c++-common/auto-init-11.c: Likewise.
* c-c++-common/auto-init-12.c: Likewise.
* c-c++-common/auto-init-13.c: Likewise.
* c-c++-common/auto-init-14.c: Likewise.
* c-c++-common/auto-init-15.c: Likewise.
* c-c++-common/auto-init-16.c: Likewise.
* c-c++-common/auto-init-2.c: Likewise.
* c-c++-common/auto-init-3.c: Likewise.
* c-c++-common/auto-init-4.c: Likewise.
* c-c++-common/auto-init-5.c: Likewise.
* c-c++-common/auto-init-6.c: Likewise.
* c-c++-common/auto-init-7.c: Likewise.
* c-c++-common/auto-init-8.c: Likewise.
* c-c++-common/auto-init-9.c: Likewise.
* c-c++-common/auto-init-esra.c: Likewise.
* c-c++-common/auto-init-padding-1.c: Likewise.
* gcc.target/aarch64/auto-init-2.c: Likewise.

23 files changed:
gcc/gimplify.c
gcc/internal-fn.c
gcc/testsuite/c-c++-common/auto-init-1.c
gcc/testsuite/c-c++-common/auto-init-10.c
gcc/testsuite/c-c++-common/auto-init-11.c
gcc/testsuite/c-c++-common/auto-init-12.c
gcc/testsuite/c-c++-common/auto-init-13.c
gcc/testsuite/c-c++-common/auto-init-14.c
gcc/testsuite/c-c++-common/auto-init-15.c
gcc/testsuite/c-c++-common/auto-init-16.c
gcc/testsuite/c-c++-common/auto-init-2.c
gcc/testsuite/c-c++-common/auto-init-3.c
gcc/testsuite/c-c++-common/auto-init-4.c
gcc/testsuite/c-c++-common/auto-init-5.c
gcc/testsuite/c-c++-common/auto-init-6.c
gcc/testsuite/c-c++-common/auto-init-7.c
gcc/testsuite/c-c++-common/auto-init-8.c
gcc/testsuite/c-c++-common/auto-init-9.c
gcc/testsuite/c-c++-common/auto-init-esra.c
gcc/testsuite/c-c++-common/auto-init-padding-1.c
gcc/testsuite/gcc.target/aarch64/auto-init-2.c
gcc/tree-cfg.c
gcc/tree-sra.c

index d1b27d7f46f4968f85bd252c2de0dd4fd4b54c75..d64d9c447ce8009436f8ce4766051b0b044d557b 100644 (file)
@@ -1748,16 +1748,13 @@ force_labels_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
    Build a call to internal const function DEFERRED_INIT:
    1st argument: SIZE of the DECL;
    2nd argument: INIT_TYPE;
-   3rd argument: IS_VLA, 0 NO, 1 YES;
+   3rd argument: NAME of the DECL;
+
+   as LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, NAME of the DECL).  */
 
-   as LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, IS_VLA)
-   if IS_VLA is false, the LHS is the DECL itself,
-   if IS_VLA is true, the LHS is a MEM_REF whose address is the pointer
-   to this DECL.  */
 static void
 gimple_add_init_for_auto_var (tree decl,
                              enum auto_init_type init_type,
-                             bool is_vla,
                              gimple_seq *seq_p)
 {
   gcc_assert (auto_var_p (decl));
@@ -1767,13 +1764,25 @@ gimple_add_init_for_auto_var (tree decl,
 
   tree init_type_node
     = build_int_cst (integer_type_node, (int) init_type);
-  tree is_vla_node
-    = build_int_cst (integer_type_node, (int) is_vla);
+
+  tree decl_name = NULL_TREE;
+  if (DECL_NAME (decl))
+
+    decl_name = build_string_literal (IDENTIFIER_LENGTH (DECL_NAME (decl)) + 1,
+                                     IDENTIFIER_POINTER (DECL_NAME (decl)));
+
+  else
+    {
+      char *decl_name_anonymous = xasprintf ("D.%u", DECL_UID (decl));
+      decl_name = build_string_literal (strlen (decl_name_anonymous) + 1,
+                                       decl_name_anonymous);
+      free (decl_name_anonymous);
+    }
 
   tree call = build_call_expr_internal_loc (loc, IFN_DEFERRED_INIT,
                                            TREE_TYPE (decl), 3,
                                            decl_size, init_type_node,
-                                           is_vla_node);
+                                           decl_name);
 
   gimplify_assign (decl, call, seq_p);
 }
@@ -1947,7 +1956,6 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
        {
          gimple_add_init_for_auto_var (decl,
                                        flag_auto_var_init,
-                                       is_vla,
                                        seq_p);
          /* The expanding of a call to the above .DEFERRED_INIT will apply
             block initialization to the whole space covered by this variable.
index b24102a5990bea4cbb102069f7a6df497fc81ebf..db16179c9f83341e5643af6e824cde3c98f5148f 100644 (file)
@@ -3011,11 +3011,7 @@ expand_UNIQUE (internal_fn, gcall *stmt)
 }
 
 /* Expand the IFN_DEFERRED_INIT function:
-   LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, IS_VLA);
-
-   if IS_VLA is false, the LHS is the DECL itself,
-   if IS_VLA is true, the LHS is a MEM_REF whose address is the pointer
-   to this DECL.
+   LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, NAME of the DECL);
 
    Initialize the LHS with zero/pattern according to its second argument
    INIT_TYPE:
@@ -3071,8 +3067,8 @@ expand_DEFERRED_INIT (internal_fn, gcall *stmt)
 
   if (!reg_lhs)
     {
-      /* If this is a VLA or the variable is not in register,
-        expand to a memset to initialize it.  */
+      /* If the variable is not in register, expand to a memset
+        to initialize it.  */
       mark_addressable (lhs);
       tree var_addr = build_fold_addr_expr (lhs);
 
index 84ba0a90d45a2a98743bcdbf834ac9e421e9a11c..df04358728bab7e998c74572143785b3535a3e35 100644 (file)
@@ -29,13 +29,13 @@ void foo()
   return;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
-/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
-/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" { target ilp32 } } } */
-/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" { target lp64 } } } */
-/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 2, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 2, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 2, \&\"temp3\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 2, \&\"temp4\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 2, \&\"temp5\"" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 2, \&\"temp5\"" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 2, \&\"temp6\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 2, \&\"temp7\"" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 2, \&\"temp7\"" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 2, \&\"temp8\"" "gimple" } } */
index f35205f2a300bcb4f9fa42bac80e1ccac03cb9e9..dda7ea1e0324288378c5526f9a65ebd38d7522fd 100644 (file)
@@ -18,5 +18,5 @@ void foo()
   return;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 1, \&\"temp1\"" "gimple" } } */
 /* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(" "gimple" } } */
index a2d66908d83efc83b503ca22dec7db5c2dddf5fd..6eb468785ce14a4eded0035039951e07e2c57d40 100644 (file)
@@ -11,4 +11,4 @@ void foo(int n)
   return;
 }
 
-/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, 1\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, \&\"arr\"" "gimple" } } */
index f05d743fda024693d31b833aadfb278f84971473..964291c5bd9498905dc83c5b490d520e8796cdd5 100644 (file)
@@ -11,4 +11,4 @@ void foo(int n)
   return;
 }
 
-/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, 1\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, \&\"arr\"" "gimple" } } */
index b0c0365b288a796fb90ba4485eb97caa3c4dccab..aa5883af770f86d6d198d8488d2b90030ffa67e0 100644 (file)
@@ -19,5 +19,5 @@ int foo()
   return d.b + var.bar.b;
 }
 
-/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 1, \&\"d\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 1, \&\"var\"" "gimple" } } */
index 986bb19faaf0f4f85b188dd35046deb2d5f018d8..dd1ff3e339d2a256f7ea7e766828722ff38f2bc5 100644 (file)
@@ -19,5 +19,5 @@ int foo()
   return d.b + var.bar.b;
 }
 
-/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "d = .DEFERRED_INIT \\(4, 2, \&\"d\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "var = .DEFERRED_INIT \\(4, 2, \&\"var\"" "gimple" } } */
index aa9d7fab68a69aef098aef2b63d14f05d2432245..5857287ecbef3af061c1dcd6e5efae80e0ce160f 100644 (file)
@@ -10,4 +10,4 @@ void foo(int a)
   g(x);
 }
 
-/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, 1\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 2, \&\"x\"" "gimple" } } */
index 86493eef9e47feef4e2b646c0ffc292926b14676..1e309959fc5c1a268b9508b6a8cbcf016f116d00 100644 (file)
@@ -10,4 +10,4 @@ void foo(int a)
   g(x);
 }
 
-/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, 1\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(D.\\d*, 1, \&\"x\"" "gimple" } } */
index 69768d6451da239fe6377a1611aa931793851935..6ac63bb1ddac1dcac53ed43adee23e942a0c5f5c 100644 (file)
@@ -29,13 +29,13 @@ void foo()
   return;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
-/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
-/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" { target ilp32 } } } */
-/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" { target lp64 } } } */
-/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(1, 1, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(2, 1, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(4, 1, \&\"temp3\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(4, 1, \&\"temp4\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(4, 1, \&\"temp5\"" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp5 = .DEFERRED_INIT \\(8, 1, \&\"temp5\"" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp6 = .DEFERRED_INIT \\(8, 1, \&\"temp6\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(4, 1, \&\"temp7\"" "gimple" { target ilp32 } } } */
+/* { dg-final { scan-tree-dump "temp7 = .DEFERRED_INIT \\(8, 1, \&\"temp7\"" "gimple" { target lp64 } } } */
+/* { dg-final { scan-tree-dump "temp8 = .DEFERRED_INIT \\(1, 1, \&\"temp8\"" "gimple" } } */
index 062d60c1631e40ad904c40899118299ec11fe620..9d9c86d8dd08d276ce6597961caae3fc845e462b 100644 (file)
@@ -14,6 +14,6 @@ long double foo()
   return result;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 2, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 2, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 2, \&\"temp3\"" "gimple" } } */
index 9d8f23ed4e333c33b7a88e40ad58e5b3fcdcd24a..848df2a0e26497c058a6118c7da700eda774aa03 100644 (file)
@@ -14,6 +14,6 @@ long double foo()
   return result;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(4, 1, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(8, 1, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((8|12|16), 1, \&\"temp3\"" "gimple" } } */
index 9c98a6e7ab2ac35bc72e21ffbef44c133c69306a..9c4de6121826ac8226dc17c666413c45b5d64087 100644 (file)
@@ -15,7 +15,7 @@ _Complex long double foo()
   return result;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 2, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 2, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 2, \&\"temp3\"" "gimple" } } */
 
index 3fe24562ebb37e4f4c90f3fa1baf3c7e85220e71..6a406447f3d99e7e05aa909f8ca200392b2e7b4b 100644 (file)
@@ -15,7 +15,7 @@ _Complex long double foo()
   return result;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(8, 1, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(16, 1, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\((16|24|32), 1, \&\"temp3\"" "gimple" } } */
 
index 19986969a8f7052b753e890437e20812f0c1a912..b44dd5e68ed19c73353fb3154c7a76571d78bea7 100644 (file)
@@ -29,7 +29,7 @@ double foo()
   return result;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 2, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 2, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 2, \&\"temp3\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 2, \&\"temp4\"" "gimple" } } */
index 9778e911e3ad62473d1b79635210902d209704d9..739ac02893157bf9d38ed5b30f672a0c96a6890a 100644 (file)
@@ -29,7 +29,7 @@ double foo()
   return result;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 1, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(12, 1, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp2 = .DEFERRED_INIT \\(24, 1, \&\"temp2\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp3 = .DEFERRED_INIT \\(28, 1, \&\"temp3\"" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp4 = .DEFERRED_INIT \\(8, 1, \&\"temp4\"" "gimple" } } */
index 29acb7f86691d0cfbf81450a6256babb4806ed28..113107ffd5c04d957a373352650e7436e6f7578e 100644 (file)
@@ -16,5 +16,5 @@ void foo()
   return;
 }
 
-/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 2, 0\\)" "gimple" } } */
-/* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(8, 2, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump "temp1 = .DEFERRED_INIT \\(2, 2, \&\"temp1\"" "gimple" } } */
+/* { dg-final { scan-tree-dump-not "temp2 = .DEFERRED_INIT \\(8, 2, \&\"temp2\"" "gimple" } } */
index 77ec02355df43139623ba82ccc0be05b53ad970e..ce6779f20fcd4d24cf1cbe9cea79adf2ccb9fa25 100644 (file)
@@ -1,6 +1,6 @@
 /* Verify the strength reduction adjustment for -ftrivial-auto-var-init.  */ 
 /* { dg-do compile } */
-/* { dg-options "-O2 -ftrivial-auto-var-init=zero -fdump-tree-gimple -fdump-tree-esra" } */
+/* { dg-options "-O2 -ftrivial-auto-var-init=zero -fno-PIC -fdump-tree-gimple -fdump-tree-esra" } */
 
 
 typedef double VECTOR[3];
@@ -31,5 +31,5 @@ void VCross(VECTOR a, const VECTOR b, const VECTOR c)
  Assign_Vector(a, tmp);
 }
 
-/* { dg-final { scan-tree-dump-times "tmp = .DEFERRED_INIT \\(24, 2, 0\\)" 1 "gimple" } } */
-/* { dg-final { scan-tree-dump-times ".DEFERRED_INIT \\(8, 2, 0\\)" 3 "esra" } } */
+/* { dg-final { scan-tree-dump-times "tmp = .DEFERRED_INIT \\(24, 2, \&\"tmp\"" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times ".DEFERRED_INIT \\(8, 2, \&\"tmp\"" 3 "esra" } } */
index 83db8dde8324a0a705c7a9216fb7680dab017388..d2e322717f0e1efa7c71ec3170e5774091c0d5d8 100644 (file)
@@ -19,5 +19,5 @@ void foo(int a)
   g(s);
 }
 
-/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(24, 1, 0\\)" "gimple" } } */
+/* { dg-final { scan-tree-dump ".DEFERRED_INIT \\(24, 1, \&\"s\"" "gimple" } } */
 /* { dg-final { scan-tree-dump "__builtin_clear_padding" "gimple" } } */
index 2c54e6d603823281fc0e7058b179c115ef58872a..375befd325b0519896a71e1418b43dcc4d0e5023 100644 (file)
@@ -32,4 +32,4 @@ void foo()
 /* { dg-final { scan-rtl-dump-times "0xfe\\\]" 1 "expand" } } */
 /* { dg-final { scan-rtl-dump-times "0xfffffffffffffefe" 1 "expand" } } */
 /* { dg-final { scan-rtl-dump-times "0xfffffffffefefefe" 2 "expand" } } */
-/* { dg-final { scan-rtl-dump-times "0xfefefefefefefefe" 2 "expand" } } */
+/* { dg-final { scan-rtl-dump-times "0xfefefefefefefefe" 3 "expand" } } */
index bb3779367fee26696993b89c762482b6c3613169..b7fe313b70c394c395bd0175bf589727e6415455 100644 (file)
@@ -3455,19 +3455,14 @@ verify_gimple_call (gcall *stmt)
     }
 
   /* For a call to .DEFERRED_INIT,
-     LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, IS_VLA)
-     we should guarantee that the 1st and the 3rd arguments are consistent:
-     1st argument: SIZE of the DECL;
-     3rd argument: IS_VLA, 0 NO, 1 YES;
+     LHS = DEFERRED_INIT (SIZE of the DECL, INIT_TYPE, NAME of the DECL)
+     we should guarantee that when the 1st argument is a constant, it should
+     be the same as the size of the LHS.  */
 
-     if IS_VLA is false, the 1st argument should be a constant and the same as
-     the size of the LHS.  */
   if (gimple_call_internal_p (stmt, IFN_DEFERRED_INIT))
     {
       tree size_of_arg0 = gimple_call_arg (stmt, 0);
       tree size_of_lhs = TYPE_SIZE_UNIT (TREE_TYPE (lhs));
-      tree is_vla_node = gimple_call_arg (stmt, 2);
-      bool is_vla = (bool) TREE_INT_CST_LOW (is_vla_node);
 
       if (TREE_CODE (lhs) == SSA_NAME)
        lhs = SSA_NAME_VAR (lhs);
@@ -3477,27 +3472,13 @@ verify_gimple_call (gcall *stmt)
                                                    &size_from_arg0);
       bool is_constant_size_lhs = poly_int_tree_p (size_of_lhs,
                                                   &size_from_lhs);
-      if (!is_vla)
-       {
-         if (!is_constant_size_arg0)
-           {
-             error ("%<DEFFERED_INIT%> calls for non-VLA should have "
-                    "constant size for the first argument");
-             return true;
-           }
-         else if (!is_constant_size_lhs)
-           {
-             error ("%<DEFFERED_INIT%> calls for non-VLA should have "
-                    "constant size for the LHS");
-             return true;
-           }
-         else if (maybe_ne (size_from_arg0, size_from_lhs))
-           {
-             error ("%<DEFFERED_INIT%> calls for non-VLA should have same "
-                    "constant size for the first argument and LHS");
-             return true;
-           }
-       }
+      if (is_constant_size_arg0 && is_constant_size_lhs)
+       if (maybe_ne (size_from_arg0, size_from_lhs))
+         {
+           error ("%<DEFFERED_INIT%> calls should have same "
+                  "constant size for the first argument and LHS");
+           return true;
+         }
     }
 
   /* ???  The C frontend passes unpromoted arguments in case it
index 889c028f1d7c44ed1dbfdda6af9480888a65a7c6..e0ea2c7b308485570731f35b2223d44fe20f7604 100644 (file)
@@ -4123,7 +4123,7 @@ get_repl_default_def_ssa_name (struct access *racc, tree reg_type)
 static void
 generate_subtree_deferred_init (struct access *access,
                                tree init_type,
-                               tree is_vla,
+                               tree decl_name,
                                gimple_stmt_iterator *gsi,
                                location_t loc)
 {
@@ -4135,7 +4135,7 @@ generate_subtree_deferred_init (struct access *access,
          gimple *call
            = gimple_build_call_internal (IFN_DEFERRED_INIT, 3,
                                          TYPE_SIZE_UNIT (TREE_TYPE (repl)),
-                                         init_type, is_vla);
+                                         init_type, decl_name);
          gimple_call_set_lhs (call, repl);
          gsi_insert_before (gsi, call, GSI_SAME_STMT);
          update_stmt (call);
@@ -4144,7 +4144,7 @@ generate_subtree_deferred_init (struct access *access,
        }
       if (access->first_child)
        generate_subtree_deferred_init (access->first_child, init_type,
-                                       is_vla, gsi, loc);
+                                       decl_name, gsi, loc);
 
       access = access ->next_sibling;
     }
@@ -4152,7 +4152,7 @@ generate_subtree_deferred_init (struct access *access,
 }
 
 /* For a call to .DEFERRED_INIT:
-   var = .DEFERRED_INIT (size_of_var, init_type, is_vla);
+   var = .DEFERRED_INIT (size_of_var, init_type, name_of_var);
    examine the LHS variable VAR and replace it with a scalar replacement if
    there is one, also replace the RHS call to a call to .DEFERRED_INIT of
    the corresponding scalar relacement variable.  Examine the subtree and
@@ -4164,7 +4164,7 @@ sra_modify_deferred_init (gimple *stmt, gimple_stmt_iterator *gsi)
 {
   tree lhs = gimple_call_lhs (stmt);
   tree init_type = gimple_call_arg (stmt, 1);
-  tree is_vla = gimple_call_arg (stmt, 2);
+  tree decl_name = gimple_call_arg (stmt, 2);
 
   struct access *lhs_access = get_access_for_expr (lhs);
   if (!lhs_access)
@@ -4185,7 +4185,7 @@ sra_modify_deferred_init (gimple *stmt, gimple_stmt_iterator *gsi)
 
   if (lhs_access->first_child)
     generate_subtree_deferred_init (lhs_access->first_child,
-                                   init_type, is_vla, gsi, loc);
+                                   init_type, decl_name, gsi, loc);
   if (lhs_access->grp_covered)
     {
       unlink_stmt_vdef (stmt);