Make IPA-SRA follow comdat-local rules (PR 91956)

2019-11-25  Martin Jambor  <mjambor@suse.cz>

	PR ipa/91956
	* ipa-sra.c (process_isra_node_results): Put the new node to the
	same comdat group as the original node.

	testsuite/
	* g++.dg/ipa/pr91956.C: New test.

From-SVN: r278669
This commit is contained in:
Martin Jambor 2019-11-25 11:09:42 +01:00 committed by Martin Jambor
parent 5b01f1a57c
commit ed649cda94
4 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2019-11-25 Martin Jambor <mjambor@suse.cz>
PR ipa/91956
* ipa-sra.c (process_isra_node_results): Put the new node to the
same comdat group as the original node.
2019-11-25 Georg-Johann Lay <avr@gjlay.de>
Build double32 / long-double32 multilibs if needed.

View File

@ -3759,6 +3759,9 @@ process_isra_node_results (cgraph_node *node,
= node->create_virtual_clone (callers, NULL, new_adjustments, "isra",
suffix_counter);
suffix_counter++;
if (node->same_comdat_group)
new_node->add_to_same_comdat_group (node);
new_node->calls_comdat_local = node->calls_comdat_local;
if (dump_file)
fprintf (dump_file, " Created new node %s\n", new_node->dump_name ());

View File

@ -1,3 +1,8 @@
2019-11-25 Martin Jambor <mjambor@suse.cz>
PR ipa/91956
* g++.dg/ipa/pr91956.C: New test.
2019-11-23 Thomas Koenig <tkoenig@gcc.gnu.org>
Harald Anlauf <anlauf@gmx.de>

View File

@ -0,0 +1,27 @@
/* { dg-do compile } */
/* { dg-options "-Os -std=c++11 -fno-strict-aliasing -fno-tree-fre -fno-tree-vrp" } */
int count = 0;
struct VB
{
VB() {++count;}
};
struct B : virtual VB
{
B() : B(42) {}
B(int) {}
};
struct D : B
{
D() {}
D(int) : D() {}
};
int main()
{
D d{42};
if (count != 1)
__builtin_abort();
}