Hello. Following patch is pre-approved by Honza, where IPA split should properly set a comdat gruop if an original function lives in any. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
Martin
>From b876a766c2e5ffcf78fdc56e2ff5b87c1e99d30b Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Thu, 6 Apr 2017 16:31:13 +0200 Subject: [PATCH] Add function part to a same comdat group (PR ipa/80212). gcc/testsuite/ChangeLog: 2017-04-06 Martin Liska <mli...@suse.cz> PR ipa/80212 * g++.dg/ipa/pr80212.C: New test. gcc/ChangeLog: 2017-04-06 Martin Liska <mli...@suse.cz> PR ipa/80212 * ipa-split.c (split_function): Add function part to a same comdat group. --- gcc/ipa-split.c | 3 +++ gcc/testsuite/g++.dg/ipa/pr80212.C | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ipa/pr80212.C diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index da3c2c62344..ae1de6f1e63 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1363,6 +1363,9 @@ split_function (basic_block return_bb, struct split_point *split_point, /* Let's take a time profile for splitted function. */ node->tp_first_run = cur_node->tp_first_run + 1; + if (cur_node->same_comdat_group) + node->add_to_same_comdat_group (cur_node); + /* For usual cloning it is enough to clear builtin only when signature changes. For partial inlining we however can not expect the part of builtin implementation to have same semantic as the whole. */ 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; } -- 2.12.2