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/99987] [12/13/14 Regression] missed optimization for dead code elimination at -O3 (vs. -O2) Date: Fri, 18 Aug 2023 06:36:44 +0000 [thread overview] Message-ID: <bug-99987-4-3S3uBCGgDt@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99987-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99987 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to fail| |7.5.0 --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So this is bascially the missed optimization: ``` void foo(void); int main() { unsigned h = 123+5; for(unsigned g = 123; g != 0; g--) { h--; if(h == 0) foo(); } } ``` The relationship between h and g is `h = g + 5` so you can never get `h == 0` in the loop as the range of g is [123,0]. Note In the original testcase, only GCC 8-11 dom3 (on x86_64; but not on aarch64 due to IVOPTS differences) could optimize away the call to foo. Also note LLVM can optimize it away both the above testcase and the original one.
next prev parent reply other threads:[~2023-08-18 6:36 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-09 9:54 [Bug ipa/99987] New: " zhendong.su at inf dot ethz.ch 2021-04-09 10:52 ` [Bug tree-optimization/99987] " rguenth at gcc dot gnu.org 2023-05-05 7:50 ` [Bug tree-optimization/99987] [12/13/14 Regression] " pinskia at gcc dot gnu.org 2023-05-08 12:21 ` rguenth at gcc dot gnu.org 2023-05-09 11:39 ` marxin at gcc dot gnu.org 2023-08-18 6:13 ` pinskia at gcc dot gnu.org 2023-08-18 6:36 ` pinskia at gcc dot gnu.org [this message] 2024-03-10 2:45 ` law 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-99987-4-3S3uBCGgDt@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).