diff options
author | Martin Liska <mliska@suse.cz> | 2017-04-11 18:38:19 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2017-04-11 16:38:19 +0000 |
commit | c6cf6ef7c090883c950ed6bec89bbee887130130 (patch) | |
tree | 88739d6627affe2cdcd6339aac2c0a20b8452b43 /gcc | |
parent | 58928b3589e98d5db034d9700b12d15015c36346 (diff) | |
download | gcc-c6cf6ef7c090883c950ed6bec89bbee887130130.zip gcc-c6cf6ef7c090883c950ed6bec89bbee887130130.tar.gz gcc-c6cf6ef7c090883c950ed6bec89bbee887130130.tar.bz2 |
Add function part to a same comdat group (PR ipa/80212).
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-04-11 Martin Liska <mliska@suse.cz>
PR ipa/80212
* g++.dg/ipa/pr80212.C: New test.
From-SVN: r246848
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cgraph.c | 2 | ||||
-rw-r--r-- | gcc/ipa-split.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/pr80212.C | 18 |
5 files changed, 41 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1536626..4e62a49 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 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-04-11 Martin Liska <mliska@suse.cz> + + PR ipa/80212 * ipa-cp.c (determine_versionability): Handle calls_comdat_local flags. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 92ae091..e505b10 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 da3c2c6..80fc31b 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 89196e6..584813f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-11 Martin Liska <mliska@suse.cz> + + PR ipa/80212 + * g++.dg/ipa/pr80212.C: New test. + 2017-04-11 Martin Sebor <msebor@redhat.com> 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 0000000..60d3b61 --- /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; } |