Hi, this is patch that moves updates to WPA time. Does it work for you? Honza
2020-10-27 Jan Hubicka <hubi...@ucw.cz> * ipa-modref.c (modref_summaries_lto::duplicate): Check that no clones happens after modref. (modref_transform): Rename to ... (update_signature): ... this one. (pass_ipa_modref::execute): Update all summaries once done. diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 3a70965d156..235d712a986 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1080,6 +1080,9 @@ modref_summaries_lto::duplicate (cgraph_node *, cgraph_node *, modref_summary_lto *src_data, modref_summary_lto *dst_data) { + /* Be sure that no furhter cloning happens after ipa-modref. If it does + we will need to update signatures for possible param changes. */ + gcc_checking_assert (!((modref_summaries_lto *)summaries_lto)->propagated); dst_data->stores = modref_records_lto::create_ggc (src_data->stores->max_bases, src_data->stores->max_refs, @@ -1503,14 +1506,14 @@ remap_arguments (vec <int> *map, modref_records *tt) /* If signature changed, update the summary. */ -static unsigned int -modref_transform (struct cgraph_node *node) +static void +update_signature (struct cgraph_node *node) { if (!node->clone.param_adjustments || !optimization_summaries) - return 0; + return; modref_summary *r = optimization_summaries->get (node); if (!r) - return 0; + return; if (dump_file) { fprintf (dump_file, "Updating summary for %s from:\n", @@ -1546,7 +1549,7 @@ modref_transform (struct cgraph_node *node) fprintf (dump_file, "to:\n"); r->dump (dump_file); } - return 0; + return; } /* Definition of the modref IPA pass. */ @@ -1575,7 +1578,7 @@ public: modref_read, /* read_optimization_summary */ NULL, /* stmt_fixup */ 0, /* function_transform_todo_flags_start */ - modref_transform,/* function_transform */ + NULL, /* function_transform */ NULL) /* variable_transform */ {} @@ -2137,6 +2140,9 @@ pass_ipa_modref::execute (function *) modref_propagate_in_scc (component_node); } + cgraph_node *node; + FOR_EACH_FUNCTION (node) + update_signature (node); if (summaries_lto) ((modref_summaries_lto *)summaries_lto)->propagated = true; ipa_free_postorder_info (); diff --git a/gcc/testsuite/g++.dg/ipa/devirt-24.C b/gcc/testsuite/g++.dg/ipa/devirt-24.C index eaef1f5b3f8..7b5b806dd05 100644 --- a/gcc/testsuite/g++.dg/ipa/devirt-24.C +++ b/gcc/testsuite/g++.dg/ipa/devirt-24.C @@ -37,4 +37,4 @@ C *b = new (C); } } /* { dg-final { scan-ipa-dump-times "Discovered a virtual call to a known target" 1 "inline" { xfail *-*-* } } } */ -/* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 1 "cp" } } */ +/* { dg-final { scan-ipa-dump-times "Aggregate passed by reference" 2 "cp" } } */