Merge load/stores in ipa-modref summaries
commit5c85f29537662f1f4195a102cbf0182ffa32d8ac
authorJan Hubicka <hubicka@ucw.cz>
Wed, 25 Aug 2021 19:43:07 +0000 (25 21:43 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Wed, 25 Aug 2021 19:43:07 +0000 (25 21:43 +0200)
treeebfc0f226199e0f3d67e8aeb37b7f78f69239d60
parentbb24717e5042b6e8a3847e780a8d215edb9c62f6
Merge load/stores in ipa-modref summaries

this patch adds logic needed to merge neighbouring accesses in ipa-modref
summaries.  This helps analyzing array initializers and similar code.  It is
bit of work, since it breaks the fact that modref tree makes a good lattice for
dataflow: the access ranges can be extended indefinitely.  For this reason I
added counter tracking number of adjustments and a cap to limit them during the
dataflow.

gcc/ChangeLog:

* doc/invoke.texi: Document --param modref-max-adjustments.
* ipa-modref-tree.c (test_insert_search_collapse): Update.
(test_merge): Update.
* ipa-modref-tree.h (struct modref_access_node): Add adjustments;
(modref_access_node::operator==): Fix handling of access ranges.
(modref_access_node::contains): Constify parameter; handle also
mismatched parm offsets.
(modref_access_node::update): New function.
(modref_access_node::merge): New function.
(unspecified_modref_access_node): Update constructor.
(modref_ref_node::insert_access): Add record_adjustments parameter;
handle merging.
(modref_ref_node::try_merge_with): New private function.
(modref_tree::insert): New record_adjustments parameter.
(modref_tree::merge): New record_adjustments parameter.
(modref_tree::copy_from): Update.
* ipa-modref.c (dump_access): Dump adjustments field.
(get_access): Update constructor.
(record_access): Update call of insert.
(record_access_lto): Update call of insert.
(merge_call_side_effects): Add record_adjustments parameter.
(get_access_for_fnspec): Update.
(process_fnspec): Update.
(analyze_call): Update.
(analyze_function): Update.
(read_modref_records): Update.
(ipa_merge_modref_summary_after_inlining): Update.
(propagate_unknown_call): Update.
(modref_propagate_in_scc): Update.
* params.opt (param-max-modref-adjustments=): New.

gcc/testsuite/ChangeLog:

* gcc.dg/ipa/modref-1.c: Update testcase.
* gcc.dg/tree-ssa/modref-4.c: Update testcase.
* gcc.dg/tree-ssa/modref-8.c: New test.
gcc/doc/invoke.texi
gcc/ipa-modref-tree.c
gcc/ipa-modref-tree.h
gcc/ipa-modref.c
gcc/params.opt
gcc/testsuite/gcc.dg/ipa/modref-1.c
gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
gcc/testsuite/gcc.dg/tree-ssa/modref-8.c [new file with mode: 0644]