public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105832] [13/14 Regression] Dead Code Elimination Regression at -O3 (trunk vs. 12.1.0) Date: Wed, 12 Jul 2023 18:00:46 +0000 [thread overview] Message-ID: <bug-105832-4-oX6fXvE6mr@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105832-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105832 --- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I think the simple way of fixing this is optimizing: ``` bool f(int g) { return (1 >> g) != 0; } ``` into ``` bool f0(int g) { return g == 0; } ``` In threadfull1 (before vrp1) we have: ``` <bb 5> [local count: 894749065]: if (iftmp.0_6 <= 1) goto <bb 6>; [41.00%] else goto <bb 8>; [59.00%] <bb 6> [local count: 366847113]: _3 = (int) iftmp.0_6; _4 = 1 >> _3; if (_4 == 0) goto <bb 7>; [50.00%] else goto <bb 8>; [50.00%] <bb 7> [local count: 183423557]: iftmp.1_12 = iftmp.0_6 << 1; <bb 8> [local count: 894749065]: # iftmp.1_7 = PHI <iftmp.1_12(7), iftmp.0_6(5), iftmp.0_6(6)> ``` if we optimize the bb6 to: ``` if (iftmp.0_6 != 0) goto <bb 7>; [50.00%] else goto <bb 8>; [50.00%] ``` We should be able to ifcombine the 2 GIMPLE to just: iftmp.0_6 != 0 && iftmp.0_6 <= 1 Which then will unswitch correctly ...
next prev parent reply other threads:[~2023-07-12 18:00 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-03 9:59 [Bug tree-optimization/105832] New: " theodort at inf dot ethz.ch 2022-06-13 12:35 ` [Bug tree-optimization/105832] [13 Regression] " rguenth at gcc dot gnu.org 2022-06-14 11:14 ` rguenth at gcc dot gnu.org 2022-06-14 11:50 ` rguenth at gcc dot gnu.org 2022-12-20 14:03 ` rguenth at gcc dot gnu.org 2022-12-22 12:03 ` marxin at gcc dot gnu.org 2022-12-22 12:56 ` rguenth at gcc dot gnu.org 2022-12-22 14:48 ` marxin at gcc dot gnu.org 2023-02-21 14:27 ` rguenth at gcc dot gnu.org 2023-04-08 14:43 ` law at gcc dot gnu.org 2023-04-26 6:56 ` [Bug tree-optimization/105832] [13/14 " rguenth at gcc dot gnu.org 2023-07-12 18:00 ` pinskia at gcc dot gnu.org [this message] 2023-07-12 18:29 ` law at gcc dot gnu.org 2023-07-27 9:23 ` rguenth at gcc dot gnu.org 2023-08-07 8:40 ` pinskia at gcc dot gnu.org 2023-09-03 5:42 ` pinskia at gcc dot gnu.org 2023-09-03 6:31 ` pinskia at gcc dot gnu.org 2023-09-03 16:27 ` pinskia at gcc dot gnu.org 2023-09-05 20:57 ` cvs-commit at gcc dot gnu.org 2023-09-05 20:59 ` pinskia 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-105832-4-oX6fXvE6mr@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).