public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95489] Failure to optimize x && (x & y) to x & y Date: Wed, 03 Jun 2020 06:39:46 +0000 [thread overview] Message-ID: <bug-95489-4-q9FJoaTqzX@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-95489-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95489 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-06-03 Keywords| |easyhack Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- phiopt1 sees <bb 2> : if (x_3(D) != 0) goto <bb 3>; [INV] else goto <bb 4>; [INV] <bb 3> : _1 = x_3(D) & y_4(D); if (_1 != 0) goto <bb 5>; [INV] else goto <bb 4>; [INV] <bb 4> : <bb 5> : # iftmp.0_2 = PHI <1(3), 0(4)> return iftmp.0_2; and ifcombine_ifandif fails to combine the conditions via maybe_fold_and_comparisons. Via ifcombine we're looking also at simplifying _tem1 = _1 != 0; _tem2 = x_3(D) != 0; _tem1 & _tem2 and thus (bit_and (ne (bit_and x_3 y_4) 0) (ne x_3 0)) where I'd say we miss (bit_and (ne @0 integer_zerop) (ne @1 integer_zerop)) -> (ne (bit_and @0 @1) integer_zerop) if @0 and @1 have compatible enough types. That would probably do the trick here. Eventually works for generic equal values besides zero. And also for bit_ior (but there only for special constants).
next prev parent reply other threads:[~2020-06-03 6:39 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-03 4:20 [Bug tree-optimization/95489] New: " gabravier at gmail dot com 2020-06-03 6:39 ` rguenth at gcc dot gnu.org [this message] 2020-06-03 11:25 ` [Bug tree-optimization/95489] " glisse at gcc dot gnu.org 2021-07-25 4:19 ` pinskia at gcc dot gnu.org 2023-05-06 18:56 ` 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-95489-4-q9FJoaTqzX@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).