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/103417] [12 Regression] wrong code at -O1 and above on x86_64-linux-gnu since r12-5489 Date: Thu, 25 Nov 2021 09:48:05 +0000 [thread overview] Message-ID: <bug-103417-4-ZRngER23dc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103417-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103417 --- Comment #6 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:94912212d3d1be0b1c490e9b5f45165ef5f30d8a commit r12-5513-g94912212d3d1be0b1c490e9b5f45165ef5f30d8a Author: Jakub Jelinek <jakub@redhat.com> Date: Thu Nov 25 10:47:24 2021 +0100 match.pd: Fix up the recent bitmask_inv_cst_vector_p simplification [PR103417] The following testcase is miscompiled since the r12-5489-g0888d6bbe97e10 changes. The simplification triggers on (x & 4294967040U) >= 0U and turns it into: x <= 255U which is incorrect, it should fold to 1 because unsigned >= 0U is always true and normally the /* Non-equality compare simplifications from fold_binary */ (if (wi::to_wide (cst) == min) (if (cmp == GE_EXPR) { constant_boolean_node (true, type); }) simplification folds that, but this simplification was done earlier. The simplification correctly doesn't include lt which has the same reason why it shouldn't be handled, we'll fold it to 0 elsewhere. But, IMNSHO while it isn't incorrect to handle le and gt there, it is unnecessary. Because (x & cst) <= 0U and (x & cst) > 0U should never appear, again in /* Non-equality compare simplifications from fold_binary */ we have a simplification for it: (if (cmp == LE_EXPR) (eq @2 @1)) (if (cmp == GT_EXPR) (ne @2 @1)))) This is done for (cmp (convert?@2 @0) uniform_integer_cst_p@1) and so should be done for both integers and vectors. As the bitmask_inv_cst_vector_p simplification only handles eq and ne for signed types, I think it can be simplified to just following patch. 2021-11-25 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/103417 * match.pd ((X & Y) CMP 0): Only handle eq and ne. Commonalize common tests. * gcc.c-torture/execute/pr103417.c: New test.
next prev parent reply other threads:[~2021-11-25 9:48 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-24 20:49 [Bug tree-optimization/103417] New: wrong code at -O1 and above on x86_64-linux-gnu zhendong.su at inf dot ethz.ch 2021-11-24 21:02 ` [Bug tree-optimization/103417] " pinskia at gcc dot gnu.org 2021-11-24 21:02 ` [Bug tree-optimization/103417] [12 Regression] " pinskia at gcc dot gnu.org 2021-11-24 21:03 ` [Bug tree-optimization/103417] [12 Regression] wrong code at -O1 and above on x86_64-linux-gnu since r12-5489 jakub at gcc dot gnu.org 2021-11-24 21:16 ` jakub at gcc dot gnu.org 2021-11-24 21:45 ` jakub at gcc dot gnu.org 2021-11-25 2:44 ` tnfchris at gcc dot gnu.org 2021-11-25 9:48 ` cvs-commit at gcc dot gnu.org [this message] 2021-11-25 15:22 ` 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-103417-4-ZRngER23dc@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).