public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104639] [12 Regression] Useless loop not fully optimized anymore Date: Mon, 11 Apr 2022 08:45:41 +0000 [thread overview] Message-ID: <bug-104639-4-LYMRJzjk1W@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104639-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104639 --- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:a42aa68bf1ad745a6b36ab9beed1fc2e77ac3f88 commit r12-8078-ga42aa68bf1ad745a6b36ab9beed1fc2e77ac3f88 Author: Jakub Jelinek <jakub@redhat.com> Date: Mon Apr 11 10:44:28 2022 +0200 phiopt: Optimize (x != cst1 ? x : cst2) != cst3 [PR104639] Here is an attempt to resolve a P1 regression, where due to threading changes we no longer optimize bool foo(int i) { while (i == 4) i += 2; return i; } to just return i != 0; by enhancing the phiopt value_replacement optimization. Normally it will optimize x != cst1 ? x : cst1 to x. Here we extend it to also optimize x != cst1 ? x : cst2 to x if it (phi result) has a single immediate use which is a comparison with some INTEGER_CST cst3 and we can prove that we don't care whether x is cst1 or cst2 because both compare the same against cst3. 2022-04-11 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/104639 * tree-ssa-phiopt.cc: Include tree-ssa-propagate.h. (value_replacement): Optimize (x != cst1 ? x : cst2) != cst3 into x != cst3. * gcc.dg/tree-ssa/pr104639-1.c: New test. * gcc.dg/tree-ssa/pr104639-2.c: New test.
next prev parent reply other threads:[~2022-04-11 8:45 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-22 12:53 [Bug tree-optimization/104639] New: " denis.campredon at gmail dot com 2022-02-22 13:07 ` [Bug tree-optimization/104639] [12 Regression] " jakub at gcc dot gnu.org 2022-02-22 13:16 ` jakub at gcc dot gnu.org 2022-02-22 15:23 ` rguenth at gcc dot gnu.org 2022-02-22 15:36 ` jakub at gcc dot gnu.org 2022-02-22 17:40 ` denis.campredon at gmail dot com 2022-02-22 18:06 ` jakub at gcc dot gnu.org 2022-03-03 11:36 ` aldyh at gcc dot gnu.org 2022-03-03 13:57 ` amacleod at redhat dot com 2022-03-03 14:04 ` aldyh at gcc dot gnu.org 2022-03-03 14:28 ` amacleod at redhat dot com 2022-03-03 15:04 ` aldyh at gcc dot gnu.org 2022-04-04 13:58 ` jakub at gcc dot gnu.org 2022-04-08 16:44 ` jakub at gcc dot gnu.org 2022-04-11 8:45 ` cvs-commit at gcc dot gnu.org [this message] 2022-04-11 9:03 ` jakub 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-104639-4-LYMRJzjk1W@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).