From: Martin Liska Date: Tue, 11 Apr 2017 16:38:19 +0000 (+0200) Subject: Add function part to a same comdat group (PR ipa/80212). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c6cf6ef7c090883c950ed6bec89bbee887130130;p=gcc.git Add function part to a same comdat group (PR ipa/80212). 2017-04-11 Martin Liska 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-04-11 Martin Liska PR ipa/80212 * g++.dg/ipa/pr80212.C: New test. From-SVN: r246848 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1536626851a..4e62a498246 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-04-11 Martin Liska + + 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-04-11 Martin Liska PR ipa/80212 diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 92ae0910c60..e505b10e211 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -2123,6 +2123,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 (merged_comdat) diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index da3c2c62344..80fc31b52f8 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1360,6 +1360,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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89196e60cf4..584813f361b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-11 Martin Liska + + PR ipa/80212 + * g++.dg/ipa/pr80212.C: New test. + 2017-04-11 Martin Sebor PR middle-end/80364 diff --git a/gcc/testsuite/g++.dg/ipa/pr80212.C b/gcc/testsuite/g++.dg/ipa/pr80212.C new file mode 100644 index 00000000000..60d3b613035 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr80212.C @@ -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; }