On Thu, Aug 26, 2021 at 2:49 AM Jan Hubicka <hubi...@ucw.cz> wrote: > > > On 8/26/21 10:33, Christophe Lyon via Gcc-patches wrote: > > > Can you have a look? > > > > Please create a PR for it. > I have fix, so perhaps there is no need for PR :) > I am testing the following - the problem was that try_merge_with missed > some merges because how unoredered_remove handles the vector. > > Bootstrapping/regtesteing x86_64-linux. > > Honza > > diff --git a/gcc/ipa-modref-tree.h b/gcc/ipa-modref-tree.h > index 6f6932f0875..b27c9689987 100644 > --- a/gcc/ipa-modref-tree.h > +++ b/gcc/ipa-modref-tree.h > @@ -322,6 +322,20 @@ struct GTY((user)) modref_ref_node > every_access = true; > } > > + /* Verify that list does not contain redundant accesses. */ > + void verify () > + { > + size_t i, i2; > + modref_access_node *a, *a2; > + > + FOR_EACH_VEC_SAFE_ELT (accesses, i, a) > + { > + FOR_EACH_VEC_SAFE_ELT (accesses, i2, a2) > + if (i != i2) > + gcc_assert (!a->contains (*a2)); > + } > + } > + > /* Insert access with OFFSET and SIZE. > Collapse tree if it has more than MAX_ACCESSES entries. > If RECORD_ADJUSTMENTs is true avoid too many interval extensions. > @@ -337,6 +351,9 @@ struct GTY((user)) modref_ref_node > size_t i; > modref_access_node *a2; > > + if (flag_checking) > + verify (); > + > if (!a.useful_p ()) > { > if (!every_access) > @@ -392,13 +409,15 @@ private: > size_t i; > > FOR_EACH_VEC_SAFE_ELT (accesses, i, a2) > - if (i != index) > - if ((*accesses)[index].contains (*a2) > - || (*accesses)[index].merge (*a2, false)) > + if (i != index > + && ((*accesses)[index].contains (*a2) > + || (*accesses)[index].merge (*a2, false))) > { > - if (index == accesses->length () - 1) > - index = i; > accesses->unordered_remove (i); > + if (index == accesses->length ()) > + index = i; > + else > + i--; > } > } > };
I think commit f075b8c5adcf9cb6336563c472c8d624c54184db Author: Jan Hubicka <hubi...@ucw.cz> Date: Thu Aug 26 15:33:56 2021 +0200 Fix off-by-one error in try_merge_with gcc/ChangeLog: * ipa-modref-tree.h (modref_ref_node::verify): New member functoin. (modref_ref_node::insert): Use it. (modref_ref_node::try_mere_with): Fix off by one error. caused libgo build failure on Linux/i686: In function ??runtime.canPreemptM??: go1: internal compiler error: in verify, at ipa-modref-tree.h:335 0x8891586 modref_ref_node<int>::verify() /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref-tree.h:335 0x8891586 modref_ref_node<int>::verify() /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref-tree.h:326 0x8891586 modref_ref_node<int>::insert_access(modref_access_node, unsigned int, bool) /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref-tree.h:355 0x8891c3e modref_tree<int>::insert(int, int, modref_access_node, bool) /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref-tree.h:616 0x888a302 record_access /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref.c:713 0x888a47b analyze_load /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref.c:1217 0x87e2126 walk_stmt_load_store_addr_ops(gimple*, void*, bool (*)(gimple*, tree_node*, tree_node*, void*), bool (*)(gimple*, tree_node*, tree_node*, void*), bool (*)(gimple*, tree_node*, tree_node*, void*)) /export/gnu/import/git/gitlab/x86-gcc/gcc/gimple-walk.c:800 0x87e2be9 walk_stmt_load_store_ops(gimple*, void*, bool (*)(gimple*, tree_node*, tree_node*, void*), bool (*)(gimple*, tree_node*, tree_node*, void*)) /export/gnu/import/git/gitlab/x86-gcc/gcc/gimple-walk.c:966 0x8886398 analyze_stmt /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref.c:1268 0x8886398 analyze_function /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref.c:2130 0x8887e08 modref_generate /export/gnu/import/git/gitlab/x86-gcc/gcc/ipa-modref.c:2208 0x89d08db execute_ipa_summary_passes(ipa_opt_pass_d*) /export/gnu/import/git/gitlab/x86-gcc/gcc/passes.c:2248 0x8636e14 ipa_passes /export/gnu/import/git/gitlab/x86-gcc/gcc/cgraphunit.c:2179 0x8636e14 symbol_table::compile() /export/gnu/import/git/gitlab/x86-gcc/gcc/cgraphunit.c:2289 0x8639412 symbol_table::compile() /export/gnu/import/git/gitlab/x86-gcc/gcc/cgraphunit.c:2269 0x8639412 symbol_table::finalize_compilation_unit() /export/gnu/import/git/gitlab/x86-gcc/gcc/cgraphunit.c:2537 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. -- H.J.