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 rtl-optimization/114902] [14 Regression] wrong code at -O3 with "-fno-tree-vrp -fno-expensive-optimizations -fno-tree-dominator-opts" on x86_64-linux-gnu Date: Tue, 11 Jun 2024 06:17:28 +0000 [thread overview] Message-ID: <bug-114902-4-FWwnErPcwL@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114902-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114902 --- Comment #17 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:8deaab6f79768700e1bf05fe6af83b185f678b7f commit r13-8833-g8deaab6f79768700e1bf05fe6af83b185f678b7f Author: Jakub Jelinek <jakub@redhat.com> Date: Wed May 15 18:37:17 2024 +0200 combine: Fix up simplify_compare_const [PR115092] The following testcases are miscompiled (with tons of GIMPLE optimization disabled) because combine sees GE comparison of 1-bit sign_extract (i.e. something with [-1, 0] value range) with (const_int -1) (which is always true) and optimizes it into NE comparison of 1-bit zero_extract ([0, 1] value range) against (const_int 0). The reason is that simplify_compare_const first (correctly) simplifies the comparison to GE (ashift:SI something (const_int 31)) (const_int -2147483648) and then an optimization for when the second operand is power of 2 triggers. That optimization is fine for power of 2s which aren't the signed minimum of the mode, or if it is NE, EQ, GEU or LTU against the signed minimum of the mode, but for GE or LT optimizing it into NE (or EQ) against const0_rtx is wrong, those cases are always true or always false (but the function doesn't have a standardized way to tell callers the comparison is now unconditional). The following patch just disables the optimization in that case. 2024-05-15 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/114902 PR rtl-optimization/115092 * combine.cc (simplify_compare_const): Don't optimize GE op0 SIGNED_MIN or LT op0 SIGNED_MIN into NE op0 const0_rtx or EQ op0 const0_rtx. * gcc.dg/pr114902.c: New test. * gcc.dg/pr115092.c: New test. (cherry picked from commit 0b93a0ae153ef70a82ff63e67926a01fdab9956b)
next prev parent reply other threads:[~2024-06-11 6:17 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-30 22:13 [Bug tree-optimization/114902] New: " zhendong.su at inf dot ethz.ch 2024-05-01 2:06 ` [Bug target/114902] [14/15 Regression] " pinskia at gcc dot gnu.org 2024-05-01 2:22 ` [Bug rtl-optimization/114902] " pinskia at gcc dot gnu.org 2024-05-01 2:34 ` pinskia at gcc dot gnu.org 2024-05-01 5:12 ` pinskia at gcc dot gnu.org 2024-05-01 5:29 ` pinskia at gcc dot gnu.org 2024-05-03 8:14 ` segher at gcc dot gnu.org 2024-05-03 8:38 ` pinskia at gcc dot gnu.org 2024-05-07 7:45 ` rguenth at gcc dot gnu.org 2024-05-09 9:48 ` segher at gcc dot gnu.org 2024-05-09 9:49 ` segher at gcc dot gnu.org 2024-05-14 20:09 ` segher at gcc dot gnu.org 2024-05-14 22:04 ` pinskia at gcc dot gnu.org 2024-05-15 16:44 ` cvs-commit at gcc dot gnu.org 2024-05-15 16:54 ` [Bug rtl-optimization/114902] [14 " jakub at gcc dot gnu.org 2024-06-04 14:26 ` cvs-commit at gcc dot gnu.org 2024-06-04 14:28 ` jakub at gcc dot gnu.org 2024-06-11 6:17 ` cvs-commit at gcc dot gnu.org [this message] 2024-06-11 10:38 ` cvs-commit at gcc dot gnu.org 2024-06-20 13:23 ` cvs-commit 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-114902-4-FWwnErPcwL@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).