public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/100393] [9/10/11/12 Regression] Very slow compilation of switch statement with thousands of cases Date: Mon, 03 May 2021 13:48:51 +0000 [thread overview] Message-ID: <bug-100393-4-7BkUhnbUov@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-100393-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100393 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Samples: 847K of event 'cycles:u', Event count (approx.): 839745061761 Overhead Samples Command Shared Object Symbol 95.05% 804298 cc1 cc1 [.] tree_switch_conversion::jump_table_cluster::can_be_handled 1.69% 14493 cc1 cc1 [.] tree_switch_conversion::cluster::get_range 0.86% 7291 cc1 cc1 [.] optimize_function_for_size_p looks like there's obvious quadraticness here when doing the summing: bool jump_table_cluster::can_be_handled (const vec<cluster *> &clusters, unsigned start, unsigned end) { .. for (unsigned i = start; i <= end; i++) { simple_cluster *sc = static_cast<simple_cluster *> (clusters[i]); comparison_count += sc->m_range_p ? 2 : 1; } and we're almost trying all possible clusters in jump_table_cluster::find_jump_tables Now, there's the possibility of doing a quick guess before doing this loop, once via using (end - start) and once via using 2 * (end - start). Only if the first can be handled and the second not we have to compute. Martin?
next prev parent reply other threads:[~2021-05-03 13:48 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-03 11:46 [Bug c/100393] New: " curiousdannii at gmail dot com 2021-05-03 12:04 ` [Bug c/100393] " curiousdannii at gmail dot com 2021-05-03 13:37 ` [Bug tree-optimization/100393] [9/10/11/12 Regression] " rguenth at gcc dot gnu.org 2021-05-03 13:48 ` rguenth at gcc dot gnu.org [this message] 2021-05-03 13:58 ` rguenth at gcc dot gnu.org 2021-05-10 12:22 ` marxin at gcc dot gnu.org 2021-06-01 8:20 ` rguenth at gcc dot gnu.org 2021-08-13 15:25 ` marxin at gcc dot gnu.org 2021-08-13 15:26 ` marxin at gcc dot gnu.org 2021-08-16 11:38 ` cvs-commit at gcc dot gnu.org 2021-08-16 11:38 ` [Bug tree-optimization/100393] [9/10/11 " marxin at gcc dot gnu.org 2021-11-05 16:09 ` cvs-commit at gcc dot gnu.org 2021-11-05 16:10 ` marxin 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-100393-4-7BkUhnbUov@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).