Fix wrong code caulsed by retslot EAF flags propagation [PR103040]
authorJan Hubicka <hubicka@ucw.cz>
Wed, 3 Nov 2021 00:45:47 +0000 (01:45 +0100)
committerJan Hubicka <hubicka@ucw.cz>
Wed, 3 Nov 2021 00:45:47 +0000 (01:45 +0100)
commit62af7d9402f551fa708125fafed2950d8912b25e
tree6bbffaabf0fd0dd372077fd2914f5c922aeffb71
parentb4df2dd3f47129f7936e21bb10fe9e8e2227ba3b
Fix wrong code caulsed by retslot EAF flags propagation [PR103040]

Fixe (quite nasty) thinko in how I propagate EAF flags from callee
to caller.  In this case some flags needs to be changed.  In particular
  - EAF_NOT_RETURNED in callee does not really mean EAF_NOT_RETURNED in caller
    since we speak of different return values
  - if callee escapes the parametr, we caller may return it
  - for retslot the rewritting is even bit more funny, since escaping to of
    return slot to return slot is not really an escape, however escape of
    argument to itself is.

This patch should correct all of the cases above and does fix the testcase from PR103040.

Bootstrapped/regtested x86_64 with all languages.  Also lto-bootstrapped.

gcc/ChangeLog:

PR ipa/103040
* ipa-modref.c (callee_to_caller_flags): New function.
(modref_eaf_analysis::analyze_ssa_name): Use it.
(ipa_merge_modref_summary_after_inlining): Fix whitespace.

gcc/testsuite/ChangeLog:

* g++.dg/torture/pr103040.C: New test.
gcc/ipa-modref.c
gcc/testsuite/g++.dg/torture/pr103040.C [new file with mode: 0644]