]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport PRs 90369, 90900, 90914, 90972, 90982, 91004, 91062, 91063
authorRichard Biener <rguenther@suse.de>
Fri, 12 Jul 2019 14:42:14 +0000 (14:42 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 12 Jul 2019 14:42:14 +0000 (14:42 +0000)
2019-07-12  Richard Biener  <rguenther@suse.de>

Backport from mainline
2019-07-04  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/91063
* tree-vect-stmts.c (vect_init_vector): Call gsi_remove to remove
stmt from stmts sequence before calling vect_init_vector_1.
Formatting fix.

* gcc.dg/gomp/pr91063.c: New test.

2019-07-04  Richard Biener  <rguenther@suse.de>

PR ipa/91062
* tree-pass.h (execute_all_ipa_transforms): Add a flag
parameter whether to disable GC collection.
* passes.c (execute_one_ipa_transform_pass): Likewise, and
honor it.
(execute_all_ipa_transforms): Likewise and pass it down.
* cgraph.c (cgraph_node::get_body): Do not invoke garbage
collection from applying IPA transforms.
* cgraphunit.c (cgraph_node::expand): Allow garbage collection
from applying IPA transforms.

2019-06-27  Richard Biener  <rguenther@suse.de>

PR testsuite/91004
* g++.dg/torture/pr34850.C: Fix overly reduced testcase.

2019-06-26  Richard Biener  <rguenther@suse.de>

PR ipa/90982
* tree-inline.c (remap_ssa_name): Copy SSA range info.

* g++.dg/torture/pr90982.C: New testcase.

2019-06-24  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90972
* tree-vect-stmts.c (vect_init_vector): Handle CONSTANT_CLASS_P
in common code, dealing with STRING_CST properly.

* gcc.dg/torture/pr90972.c: New testcase.

2019-06-21  Richard Biener  <rguenther@suse.de>

PR debug/90914
* dwarf2out.c (prune_unused_types_walk): Always consider
function-local extern declarations as used.

* g++.dg/debug/pr90914.C: New testcase.

2019-06-18  Richard Biener  <rguenther@suse.de>

PR debug/90900
* cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL
as if optimized away.

* gcc.dg/gomp/pr90900.c: New testcase.

2019-05-07  Richard Biener  <rguenther@suse.de>

PR lto/90369
* lto-wrapper.c (debug_objcopy): Use the original filename
including archive offset for the filename used for -save-temps.

From-SVN: r273446

17 files changed:
gcc/ChangeLog
gcc/cfgexpand.c
gcc/cgraph.c
gcc/cgraphunit.c
gcc/dwarf2out.c
gcc/lto-wrapper.c
gcc/passes.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/pr90914.C [new file with mode: 0644]
gcc/testsuite/g++.dg/torture/pr34850.C
gcc/testsuite/g++.dg/torture/pr90982.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/pr90900.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/pr91063.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr90972.c [new file with mode: 0644]
gcc/tree-inline.c
gcc/tree-pass.h
gcc/tree-vect-stmts.c

index 8539770b5436a890fe5f1a60ea103e0c3f38dcfb..782ab90f55747dddbe99a9fdd7bbdf3380184bf9 100644 (file)
@@ -1,3 +1,55 @@
+2019-07-12  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91063
+       * tree-vect-stmts.c (vect_init_vector): Call gsi_remove to remove
+       stmt from stmts sequence before calling vect_init_vector_1.
+       Formatting fix.
+
+       2019-07-04  Richard Biener  <rguenther@suse.de>
+
+       PR ipa/91062
+       * tree-pass.h (execute_all_ipa_transforms): Add a flag
+       parameter whether to disable GC collection.
+       * passes.c (execute_one_ipa_transform_pass): Likewise, and
+       honor it.
+       (execute_all_ipa_transforms): Likewise and pass it down.
+       * cgraph.c (cgraph_node::get_body): Do not invoke garbage
+       collection from applying IPA transforms.
+       * cgraphunit.c (cgraph_node::expand): Allow garbage collection
+       from applying IPA transforms.
+
+       2019-06-26  Richard Biener  <rguenther@suse.de>
+
+       PR ipa/90982
+       * tree-inline.c (remap_ssa_name): Copy SSA range info.
+
+       2019-06-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90972
+       * tree-vect-stmts.c (vect_init_vector): Handle CONSTANT_CLASS_P
+       in common code, dealing with STRING_CST properly.
+
+       2019-06-21  Richard Biener  <rguenther@suse.de>
+
+       PR debug/90914
+       * dwarf2out.c (prune_unused_types_walk): Always consider
+       function-local extern declarations as used.
+
+       2019-06-18  Richard Biener  <rguenther@suse.de>
+
+       PR debug/90900
+       * cfgexpand.c (expand_debug_expr): Treat NOTE_P DECL_RTL
+       as if optimized away.
+
+       2019-05-07  Richard Biener  <rguenther@suse.de>
+
+       PR lto/90369
+       * lto-wrapper.c (debug_objcopy): Use the original filename
+       including archive offset for the filename used for -save-temps.
+
 2019-07-12  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR rtl-optimization/91136
index 518d71c74c8244a25a1bbdcc468ebf2ccc3c9c6d..e252975f546c2efe1696283762a569bdbcd64337 100644 (file)
@@ -4369,7 +4369,11 @@ expand_debug_expr (tree exp)
       op0 = DECL_RTL_IF_SET (exp);
 
       /* This decl was probably optimized away.  */
-      if (!op0)
+      if (!op0
+         /* At least label RTXen are sometimes replaced by
+            NOTE_INSN_DELETED_LABEL.  Any notes here are not
+            handled by copy_rtx.  */
+         || NOTE_P (op0))
        {
          if (!VAR_P (exp)
              || DECL_EXTERNAL (exp)
index b1b0b4c42d5c202916a25b54f554c891f1d6ab3e..db4c9c747b9ed871f00397f5acd907400718e214 100644 (file)
@@ -3607,7 +3607,7 @@ cgraph_node::get_body (void)
       set_dump_file (NULL);
 
       push_cfun (DECL_STRUCT_FUNCTION (decl));
-      execute_all_ipa_transforms ();
+      execute_all_ipa_transforms (true);
       cgraph_edge::rebuild_edges ();
       free_dominance_info (CDI_DOMINATORS);
       free_dominance_info (CDI_POST_DOMINATORS);
index 8bfbd0bb12f3bb13e3fbcfdcfc2a9b64f791b0fb..4a27867b82cb2d21228f43f440ab37665d1da87a 100644 (file)
@@ -2188,7 +2188,7 @@ cgraph_node::expand (void)
 
   bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
 
-  execute_all_ipa_transforms ();
+  execute_all_ipa_transforms (false);
 
   /* Perform all tree transforms and optimizations.  */
 
index 54390ea533f86feb369063ba1ed40c886e88ed9d..1cec00f2b857b248ad13a3268d15560eb1c35b23 100644 (file)
@@ -29419,9 +29419,16 @@ prune_unused_types_walk (dw_die_ref die)
            break;
 
          /* premark_used_variables marks external variables --- don't mark
-            them here.  */
+            them here.  But function-local externals are always considered
+            used.  */
          if (get_AT (die, DW_AT_external))
-           return;
+           {
+             for (c = die->die_parent; c; c = c->die_parent)
+               if (c->die_tag == DW_TAG_subprogram)
+                 break;
+             if (!c)
+               return;
+           }
        }
       /* FALLTHROUGH */
 
index 56eea90ac8c179f664a872c5c8de051e6de94f55..ac971494054914e5b68691bbac8c1e7eb0609628 100644 (file)
@@ -1044,6 +1044,7 @@ debug_objcopy (const char *infile, bool rename)
   int err;
 
   const char *p;
+  const char *orig_infile = infile;
   off_t inoff = 0;
   long loffset;
   int consumed;
@@ -1080,9 +1081,9 @@ debug_objcopy (const char *infile, bool rename)
 
   if (save_temps)
     {
-      outfile = (char *) xmalloc (strlen (infile)
+      outfile = (char *) xmalloc (strlen (orig_infile)
                                  + sizeof (".debug.temp.o") + 1);
-      strcpy (outfile, infile);
+      strcpy (outfile, orig_infile);
       strcat (outfile, ".debug.temp.o");
     }
   else
index 02561f8bf1890b4c942cc6bc85edcb437e3cafb8..d8d479a1c17a805ca50f5c12ba0c518667a1acaa 100644 (file)
@@ -2196,7 +2196,7 @@ execute_ipa_summary_passes (ipa_opt_pass_d *ipa_pass)
 
 static void
 execute_one_ipa_transform_pass (struct cgraph_node *node,
-                               ipa_opt_pass_d *ipa_pass)
+                               ipa_opt_pass_d *ipa_pass, bool do_not_collect)
 {
   opt_pass *pass = ipa_pass;
   unsigned int todo_after = 0;
@@ -2242,14 +2242,14 @@ execute_one_ipa_transform_pass (struct cgraph_node *node,
   redirect_edge_var_map_empty ();
 
   /* Signal this is a suitable GC collection point.  */
-  if (!(todo_after & TODO_do_not_ggc_collect))
+  if (!do_not_collect && !(todo_after & TODO_do_not_ggc_collect))
     ggc_collect ();
 }
 
 /* For the current function, execute all ipa transforms. */
 
 void
-execute_all_ipa_transforms (void)
+execute_all_ipa_transforms (bool do_not_collect)
 {
   struct cgraph_node *node;
   if (!cfun)
@@ -2261,7 +2261,8 @@ execute_all_ipa_transforms (void)
       unsigned int i;
 
       for (i = 0; i < node->ipa_transforms_to_apply.length (); i++)
-       execute_one_ipa_transform_pass (node, node->ipa_transforms_to_apply[i]);
+       execute_one_ipa_transform_pass (node, node->ipa_transforms_to_apply[i],
+                                       do_not_collect);
       node->ipa_transforms_to_apply.release ();
     }
 }
index c0f3a215a55400f330eb311529106963db153e73..7510eb2ef994dbe08a4888f95a1715e9b7ab6bb6 100644 (file)
@@ -1,3 +1,36 @@
+2019-07-12  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-07-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91063
+       * gcc.dg/gomp/pr91063.c: New test.
+
+       2019-06-27  Richard Biener  <rguenther@suse.de>
+
+       PR testsuite/91004
+       * g++.dg/torture/pr34850.C: Fix overly reduced testcase.
+
+       2019-06-26  Richard Biener  <rguenther@suse.de>
+
+       PR ipa/90982
+       * g++.dg/torture/pr90982.C: New testcase.
+
+       2019-06-24  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90972
+       * gcc.dg/torture/pr90972.c: New testcase.
+
+       2019-06-21  Richard Biener  <rguenther@suse.de>
+
+       PR debug/90914
+       * g++.dg/debug/pr90914.C: New testcase.
+
+       2019-06-18  Richard Biener  <rguenther@suse.de>
+
+       PR debug/90900
+       * gcc.dg/gomp/pr90900.c: New testcase.
+
 2019-07-11  Uroš Bizjak  <ubizjak@gmail.com>
 
        Backported from mainline
diff --git a/gcc/testsuite/g++.dg/debug/pr90914.C b/gcc/testsuite/g++.dg/debug/pr90914.C
new file mode 100644 (file)
index 0000000..3681d58
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-additional-options "-feliminate-unused-debug-symbols" }
+
+template <class> class A;
+void f ()
+{
+  extern A <double> b;
+}
index e41620b739d75dd4b3bc4d28f0cfd0d9265344ae..60a6c6ae57dc8c078e7050b99dceb814f14941a6 100644 (file)
@@ -13,7 +13,8 @@ extern "C" {
     extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__, __artificial__))
     void * memset (void *__dest, int __ch, size_t __len) throw () {
        if (__builtin_constant_p (__len) && __len == 0)
-           __warn_memset_zero_len ();
+         __warn_memset_zero_len ();
+       return __dest;
     }
 }
 inline void clear_mem(void* ptr, u32bit n)    {
diff --git a/gcc/testsuite/g++.dg/torture/pr90982.C b/gcc/testsuite/g++.dg/torture/pr90982.C
new file mode 100644 (file)
index 0000000..8edbb7c
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-do compile }
+
+template <int n> struct S
+{
+  long c[n];
+  void f (S d)
+    {
+      for (int i = 2;; i++)
+       c[i] &= d.c[i];
+    }
+};
+
+template <int m> struct T:S<m/64>
+{
+  void operator &= (T d)
+    { this -> f (d); }
+};
+
+void g (T<192> &d)
+{
+  T<192> v;
+  d &= v;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr90900.c b/gcc/testsuite/gcc.dg/gomp/pr90900.c
new file mode 100644 (file)
index 0000000..d4c5d7d
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -g" } */
+
+void f (int a)
+{
+  void *x = &&lab;
+#pragma omp parallel
+  if (a)
+    { lab: __builtin_unreachable(); }
+  x;
+}
diff --git a/gcc/testsuite/gcc.dg/gomp/pr91063.c b/gcc/testsuite/gcc.dg/gomp/pr91063.c
new file mode 100644 (file)
index 0000000..32938f3
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR tree-optimization/91063 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp-simd" } */
+/* { dg-additional-options "-mavx512f" { target { i?86-*-* x86_64-*-* } } } */
+
+struct S { void *s; };
+
+int
+foo (struct S *x)
+{
+  int r = 0;
+  int i;
+#pragma omp simd reduction (+ : r)
+  for (i = 0; i < 64; ++i)
+    r += (int) (x->s != 0);
+  return r;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr90972.c b/gcc/testsuite/gcc.dg/torture/pr90972.c
new file mode 100644 (file)
index 0000000..24f99b0
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mcpu=power8" { target powerpc*-*-* } } */
+
+long f;
+void a();
+void *g()
+{
+  char h[] = {}, j[] = {}, k[] = {}, l[] = {}, m[] = {}, n[] = {}, o[] = {},
+       q[] = {}, r[] = {};
+  static const char i[] = {6, 0};
+  const char *nops[] = {h, i, j, k, l, m, n, o, q, r};
+  long s = 2;
+  void *fill = a;
+  char *p = fill;
+  while (f) {
+      void *b = p;
+      const void *c = nops[1];
+      long d = s, e = __builtin_object_size(b, 0);
+      __builtin___memcpy_chk(b, c, d, e);
+      p += s;
+      f -= s;
+  }
+  return fill;
+}
index 7b62ff8a566e6fbec83d46c4eab732473f57ed2e..9fe8f26a771932b93bbff928627ebcb29e3302ea 100644 (file)
@@ -258,6 +258,11 @@ remap_ssa_name (tree name, copy_body_data *id)
          struct ptr_info_def *new_pi = get_ptr_info (new_tree);
          new_pi->pt = pi->pt;
        }
+      /* So can range-info.  */
+      if (!POINTER_TYPE_P (TREE_TYPE (name))
+         && SSA_NAME_RANGE_INFO (name))
+       duplicate_ssa_name_range_info (new_tree, SSA_NAME_RANGE_TYPE (name),
+                                      SSA_NAME_RANGE_INFO (name));
       return new_tree;
     }
 
@@ -291,6 +296,11 @@ remap_ssa_name (tree name, copy_body_data *id)
          struct ptr_info_def *new_pi = get_ptr_info (new_tree);
          new_pi->pt = pi->pt;
        }
+      /* So can range-info.  */
+      if (!POINTER_TYPE_P (TREE_TYPE (name))
+         && SSA_NAME_RANGE_INFO (name))
+       duplicate_ssa_name_range_info (new_tree, SSA_NAME_RANGE_TYPE (name),
+                                      SSA_NAME_RANGE_INFO (name));
       if (SSA_NAME_IS_DEFAULT_DEF (name))
        {
          /* By inlining function having uninitialized variable, we might
index 3a0b3805d24dbd50141d4145563861e4ae3768f3..b27dbdd0cb7d0e9033f52a9df103354364dfc5e1 100644 (file)
@@ -632,7 +632,7 @@ extern bool execute_one_pass (opt_pass *);
 extern void execute_pass_list (function *, opt_pass *);
 extern void execute_ipa_pass_list (opt_pass *);
 extern void execute_ipa_summary_passes (ipa_opt_pass_d *);
-extern void execute_all_ipa_transforms (void);
+extern void execute_all_ipa_transforms (bool);
 extern void execute_all_ipa_stmt_fixups (struct cgraph_node *, gimple **);
 extern bool pass_init_dump_file (opt_pass *);
 extern void pass_fini_dump_file (opt_pass *);
index a5fa8ec3a86fcc27cfc026e27d76c286df201d94..17769c88b6a0c7fb1f60ea3a2f2579758c64d7ef 100644 (file)
@@ -1480,27 +1480,30 @@ vect_init_vector (stmt_vec_info stmt_info, tree val, tree type,
                  val = new_temp;
                }
            }
-         else if (CONSTANT_CLASS_P (val))
-           val = fold_convert (TREE_TYPE (type), val);
          else
            {
-             new_temp = make_ssa_name (TREE_TYPE (type));
+             gimple_seq stmts = NULL;
              if (! INTEGRAL_TYPE_P (TREE_TYPE (val)))
-               init_stmt = gimple_build_assign (new_temp,
-                                                fold_build1 (VIEW_CONVERT_EXPR,
-                                                             TREE_TYPE (type),
-                                                             val));
+               val = gimple_build (&stmts, VIEW_CONVERT_EXPR,
+                                   TREE_TYPE (type), val);
              else
-               init_stmt = gimple_build_assign (new_temp, NOP_EXPR, val);
-             vect_init_vector_1 (stmt_info, init_stmt, gsi);
-             val = new_temp;
+               /* ???  Condition vectorization expects us to do
+                  promotion of invariant/external defs.  */
+               val = gimple_convert (&stmts, TREE_TYPE (type), val);
+             for (gimple_stmt_iterator gsi2 = gsi_start (stmts);
+                  !gsi_end_p (gsi2); )
+               {
+                 init_stmt = gsi_stmt (gsi2);
+                 gsi_remove (&gsi2, false);
+                 vect_init_vector_1 (stmt_info, init_stmt, gsi);
+               }
            }
        }
       val = build_vector_from_val (type, val);
     }
 
   new_temp = vect_get_new_ssa_name (type, vect_simple_var, "cst_");
-  init_stmt = gimple_build_assign  (new_temp, val);
+  init_stmt = gimple_build_assign (new_temp, val);
   vect_init_vector_1 (stmt_info, init_stmt, gsi);
   return new_temp;
 }