public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "luoxhu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105740] missed optimization switch transformation for conditions with duplicate conditions Date: Tue, 21 Jun 2022 02:45:07 +0000 [thread overview] Message-ID: <bug-105740-4-3P1gRAsfUk@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105740-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105740 --- Comment #2 from luoxhu at gcc dot gnu.org --- Run if_to_switch and convert_switch again after copyprop2 could remove the redundant statement and expose opportunity for if-to-switch again, is this reasonable or just move if-to-switch/switch-conversion later run only once? diff --git a/gcc/gimple-if-to-switch.cc b/gcc/gimple-if-to-switch.cc index f7b0b02628b..8f55d0e2f75 100644 --- a/gcc/gimple-if-to-switch.cc +++ b/gcc/gimple-if-to-switch.cc @@ -484,6 +484,8 @@ public: || bit_test_cluster::is_enabled ()); } + opt_pass *clone () { return new pass_if_to_switch (m_ctxt); } + virtual unsigned int execute (function *); }; // class pass_if_to_switch diff --git a/gcc/passes.def b/gcc/passes.def index 375d3d62d51..b257307e085 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -243,6 +243,8 @@ along with GCC; see the file COPYING3. If not see Clean them up. Failure to do so well can lead to false positives from warnings for erroneous code. */ NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_if_to_switch); + NEXT_PASS (pass_convert_switch); /* Identify paths that should never be executed in a conforming program and isolate those paths. */ NEXT_PASS (pass_isolate_erroneous_paths); diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc index 50a17927f39..d5c8262785e 100644 --- a/gcc/tree-switch-conversion.cc +++ b/gcc/tree-switch-conversion.cc @@ -2429,6 +2429,9 @@ public: /* opt_pass methods: */ virtual bool gate (function *) { return flag_tree_switch_conversion != 0; } + + opt_pass *clone () { return new pass_convert_switch (m_ctxt); } + virtual unsigned int execute (function *);
next prev parent reply other threads:[~2022-06-21 2:45 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-26 11:26 [Bug tree-optimization/105740] New: " b.buschinski at googlemail dot com 2022-05-30 9:57 ` [Bug tree-optimization/105740] " marxin at gcc dot gnu.org 2022-06-21 2:45 ` luoxhu at gcc dot gnu.org [this message] 2022-06-21 7:30 ` marxin at gcc dot gnu.org 2022-06-21 9:02 ` rguenth at gcc dot gnu.org 2022-06-21 9:12 ` jakub at gcc dot gnu.org 2022-06-21 9:26 ` rguenther at suse dot de 2022-06-21 9:29 ` cvs-commit at gcc dot gnu.org 2022-06-22 6:19 ` luoxhu at gcc dot gnu.org 2022-06-27 13:58 ` marxin at gcc dot gnu.org 2022-07-01 2:06 ` luoxhu at gcc dot gnu.org 2022-07-08 10:46 ` marxin at gcc dot gnu.org 2023-06-26 6:43 ` b.buschinski at googlemail dot com
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-105740-4-3P1gRAsfUk@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).