]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport r246848
authorMartin Liska <mliska@suse.cz>
Mon, 29 May 2017 09:11:42 +0000 (11:11 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Mon, 29 May 2017 09:11:42 +0000 (09:11 +0000)
2017-05-29  Martin Liska  <mliska@suse.cz>

Backport from mainline
2017-04-11  Martin Liska  <mliska@suse.cz>

PR ipa/80212
* cgraph.c (cgraph_node::dump): Dump calls_comdat_local.
* ipa-split.c (split_function): Create a local comdat symbol
if caller is in a comdat group.
2017-05-29  Martin Liska  <mliska@suse.cz>

Backport from mainline
2017-04-11  Martin Liska  <mliska@suse.cz>

PR ipa/80212
* g++.dg/ipa/pr80212.C: New test.

From-SVN: r248564

gcc/ChangeLog
gcc/cgraph.c
gcc/ipa-split.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr80212.C [new file with mode: 0644]

index 3350677a032dbf73e3b314cf8552f4abc99a97dd..8eca3975c6290ece703a115468955d4c997530b7 100644 (file)
@@ -1,3 +1,13 @@
+2017-05-29  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2017-04-11  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/80212
+       * cgraph.c (cgraph_node::dump): Dump calls_comdat_local.
+       * ipa-split.c (split_function): Create a local comdat symbol
+       if caller is in a comdat group.
+
 2017-05-29  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
index 448e940586fa4dbaa7a18fe8916be2992798d211..0fcd9364b189d484c44782bce8dc548aeb35077e 100644 (file)
@@ -2027,6 +2027,8 @@ cgraph_node::dump (FILE *f)
     fprintf (f, " only_called_at_exit");
   if (tm_clone)
     fprintf (f, " tm_clone");
+  if (calls_comdat_local)
+    fprintf (f, " calls_comdat_local");
   if (icf_merged)
     fprintf (f, " icf_merged");
   if (nonfreeing_fn)
index b9678e11db07747a98f65661567f797338fa35ae..c276b148859d2063d1bcfb43a6ba18c5c34ee74b 100644 (file)
@@ -1390,6 +1390,15 @@ split_function (basic_block return_bb, struct split_point *split_point,
 
   node->split_part = true;
 
+  if (cur_node->same_comdat_group)
+    {
+      /* TODO: call is versionable if we make sure that all
+        callers are inside of a comdat group.  */
+      cur_node->calls_comdat_local = 1;
+      node->add_to_same_comdat_group (cur_node);
+    }
+
+
   /* Let's take a time profile for splitted function.  */
   node->tp_first_run = cur_node->tp_first_run + 1;
 
index c88b91b937f412047a0ffc34e90c642415dc38e2..d64e5e8f90fbd679344387455afc99d8834086c2 100644 (file)
@@ -1,3 +1,11 @@
+2017-05-29  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       2017-04-11  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/80212
+       * g++.dg/ipa/pr80212.C: New test.
+
 2017-05-29  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
diff --git a/gcc/testsuite/g++.dg/ipa/pr80212.C b/gcc/testsuite/g++.dg/ipa/pr80212.C
new file mode 100644 (file)
index 0000000..60d3b61
--- /dev/null
@@ -0,0 +1,18 @@
+// PR ipa/80212
+// { dg-options "-O2 --param partial-inlining-entry-probability=403796683 -fno-early-inlining" }
+
+struct b
+{
+  virtual b *c () const;
+};
+struct d : virtual b
+{
+};
+struct e : d
+{
+  e *
+  c () const
+  {
+  }
+};
+main () { e a; }