public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114480] g++: internal compiler error: Segmentation fault signal terminated program cc1plus Date: Fri, 05 Apr 2024 15:35:59 +0000 [thread overview] Message-ID: <bug-114480-4-ye1eJeRNmd@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114480-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114480 --- Comment #21 from Alexander Monakov <amonakov at gcc dot gnu.org> --- It is possible to reduce gcc_qsort workload by improving the presorted-ness of the array, but of course avoiding quadratic behavior would be much better. With the following change, we go from 261,250,628,954 cycles:u 533,040,964,437 instructions:u # 2.04 insn per cycle 114,415,857,214 branches:u 395,327,966 branch-misses:u # 0.35% of all branches to 256,620,517,403 cycles:u 526,337,243,809 instructions:u # 2.05 insn per cycle 113,447,583,099 branches:u 383,121,251 branch-misses:u # 0.34% of all branches diff --git a/gcc/tree-into-ssa.cc b/gcc/tree-into-ssa.cc index d12a4a97f6..621793f7f4 100644 --- a/gcc/tree-into-ssa.cc +++ b/gcc/tree-into-ssa.cc @@ -805,21 +805,22 @@ prune_unused_phi_nodes (bitmap phis, bitmap kills, bitmap uses) locate the nearest dominating def in logarithmic time by binary search.*/ bitmap_ior (to_remove, kills, phis); n_defs = bitmap_count_bits (to_remove); + adef = 2 * n_defs + 1; defs = XNEWVEC (struct dom_dfsnum, 2 * n_defs + 1); defs[0].bb_index = 1; defs[0].dfs_num = 0; - adef = 1; + struct dom_dfsnum *head = defs + 1, *tail = defs + adef; EXECUTE_IF_SET_IN_BITMAP (to_remove, 0, i, bi) { def_bb = BASIC_BLOCK_FOR_FN (cfun, i); - defs[adef].bb_index = i; - defs[adef].dfs_num = bb_dom_dfs_in (CDI_DOMINATORS, def_bb); - defs[adef + 1].bb_index = i; - defs[adef + 1].dfs_num = bb_dom_dfs_out (CDI_DOMINATORS, def_bb); - adef += 2; + head->bb_index = i; + head->dfs_num = bb_dom_dfs_in (CDI_DOMINATORS, def_bb); + head++, tail--; + tail->bb_index = i; + tail->dfs_num = bb_dom_dfs_out (CDI_DOMINATORS, def_bb); } + gcc_assert (head == tail); BITMAP_FREE (to_remove); - gcc_assert (adef == 2 * n_defs + 1); qsort (defs, adef, sizeof (struct dom_dfsnum), cmp_dfsnum); gcc_assert (defs[0].bb_index == 1);
next prev parent reply other threads:[~2024-04-05 15:36 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-26 11:40 [Bug c++/114480] New: " douglas.boffey at gmail dot com 2024-03-26 11:42 ` [Bug c++/114480] " douglas.boffey at gmail dot com 2024-03-26 11:46 ` pinskia at gcc dot gnu.org 2024-03-26 11:46 ` pinskia at gcc dot gnu.org 2024-03-26 11:51 ` douglas.boffey at gmail dot com 2024-03-26 12:05 ` pinskia at gcc dot gnu.org 2024-03-26 12:15 ` pinskia at gcc dot gnu.org 2024-03-26 12:26 ` pinskia at gcc dot gnu.org 2024-03-26 12:26 ` pinskia at gcc dot gnu.org 2024-03-26 12:31 ` douglas.boffey at gmail dot com 2024-03-26 12:41 ` redi at gcc dot gnu.org 2024-03-27 8:28 ` rguenth at gcc dot gnu.org 2024-03-27 19:49 ` vmakarov at gcc dot gnu.org 2024-03-28 8:17 ` cvs-commit at gcc dot gnu.org 2024-03-28 8:44 ` rguenth at gcc dot gnu.org 2024-03-28 10:12 ` rguenth at gcc dot gnu.org 2024-03-28 10:39 ` rguenth at gcc dot gnu.org 2024-04-02 13:28 ` rguenth at gcc dot gnu.org 2024-04-03 6:57 ` cvs-commit at gcc dot gnu.org 2024-04-03 11:47 ` rguenth at gcc dot gnu.org 2024-04-04 9:42 ` rguenth at gcc dot gnu.org 2024-04-04 18:41 ` amonakov at gcc dot gnu.org 2024-04-05 15:35 ` amonakov at gcc dot gnu.org [this message] 2024-04-08 9:46 ` rguenth at gcc dot gnu.org 2024-04-08 9:50 ` douglas.boffey at gmail dot com 2024-04-08 9:54 ` rguenther at suse dot de 2024-04-08 12:32 ` douglas.boffey at gmail dot com 2024-04-08 13:07 ` rguenther at suse dot de 2024-04-08 13:22 ` [Bug c++/114480] [12/13/14 Regression " rguenth at gcc dot gnu.org 2024-04-08 13:37 ` [Bug c++/114480] [12/13/14 Regression] " rguenth at gcc dot gnu.org 2024-04-09 7:51 ` rguenth at gcc dot gnu.org 2024-04-09 11:39 ` rguenth at gcc dot gnu.org 2024-05-14 13:41 ` [Bug c++/114480] [12/13/14/15 " rguenth at gcc dot gnu.org 2024-05-17 12:29 ` cvs-commit at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-114480-4-ye1eJeRNmd@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).