]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/ipa-sra.c
Prevent IPA-SRA from creating calls to local comdats (PR 92676)
authorMartin Jambor <mjambor@suse.cz>
Thu, 2 Apr 2020 15:52:38 +0000 (17:52 +0200)
committerMartin Jambor <mjambor@suse.cz>
Thu, 2 Apr 2020 15:52:38 +0000 (17:52 +0200)
commitb90061c6ec090c6b41a44987c646c828e5165298
tree366ce819436620447d0b9af08181081b3c25a585
parent75efe9cb1f8938a713ce540dc3b27bc2afcd3fae
Prevent IPA-SRA from creating calls to local comdats (PR 92676)

since r278669 (fix for PR ipa/91956), IPA-SRA makes sure that the clone
it creates is put into the same same_comdat as the original cgraph_node,
so that it can call private comdats (such as the ipa-split bits of a
comdat that is private).

However, that means that if there is non-comdat caller of a public
comdat that is modified by IPA-SRA, it now finds itself calling a
private comdat, which call graph verifier does not like (and for a
reason, in theory it can disappear and since it is private it would not
be available from other CUs).

The patch fixes this by performing the fix for PR 91956 only when the
node in question actually calls a local comdat and when it does, also
making sure that no callers come from a different same_comdat (disabling
IPA-SRA if both conditions are true), so that it plays by the rules in
both modes, does not violate the private comdat calling rule and at the
same time does not disable the transformation unnecessarily.

The patch also fixes up the calls_comdat_local of callers of the
modified node, despite that not triggering any known issues.

2020-04-02  Martin Jambor  <mjambor@suse.cz>

PR ipa/92676
* ipa-sra.c (struct caller_issues): New fields candidate and
call_from_outside_comdat.
(check_for_caller_issues): Check for calls from outsied of
candidate's same_comdat_group.
(check_all_callers_for_issues): Set up issues.candidate, check result
of the new check.
(mark_callers_calls_comdat_local): New function.
(process_isra_node_results): Set calls_comdat_local of callers if
appropriate.
gcc/ChangeLog
gcc/ipa-sra.c