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/95731] Failure to optimize a >= 0 && b >= 0 to (a | b) >= 0 Date: Tue, 12 Jan 2021 10:05:54 +0000 [thread overview] Message-ID: <bug-95731-4-yXidyeUVcz@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-95731-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95731 --- 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:13d47c37a2c043f3e5981e73e4c82158a39f41e8 commit r11-6609-g13d47c37a2c043f3e5981e73e4c82158a39f41e8 Author: Jakub Jelinek <jakub@redhat.com> Date: Tue Jan 12 11:03:40 2021 +0100 reassoc: Optimize in reassoc x < 0 && y < 0 to (x | y) < 0 etc. [PR95731] We already had x != 0 && y != 0 to (x | y) != 0 and x != -1 && y != -1 to (x & y) != -1 and x < 32U && y < 32U to (x | y) < 32U, this patch adds signed x < 0 && y < 0 to (x | y) < 0. In that case, the low/high seem to be always the same and just in_p indices whether it is >= 0 or < 0, also, all types in the same bucket (same precision) should be type compatible, but we can have some >= 0 and some < 0 comparison mixed, so the patch handles that by using the right BIT_IOR_EXPR or BIT_AND_EXPR and doing one set of < 0 or >= 0 first, then BIT_NOT_EXPR and then the other one. I had to move optimize_range_tests_var_bound before this optimization because that one deals with signed a >= 0 && a < b, and limited it to the last reassoc pass as reassoc itself can't virtually undo this optimization yet (and not sure if vrp would be able to). 2021-01-12 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/95731 * tree-ssa-reassoc.c (optimize_range_tests_cmp_bitwise): Also optimize x < 0 && y < 0 && z < 0 into (x | y | z) < 0 for signed x, y, z. (optimize_range_tests): Call optimize_range_tests_cmp_bitwise only after optimize_range_tests_var_bound. * gcc.dg/tree-ssa/pr95731.c: New test. * gcc.c-torture/execute/pr95731.c: New test.
next prev parent reply other threads:[~2021-01-12 10:05 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-17 21:58 [Bug tree-optimization/95731] New: Faiilure " gabravier at gmail dot com 2020-06-18 8:41 ` [Bug tree-optimization/95731] " rguenth at gcc dot gnu.org 2020-06-18 9:19 ` jakub at gcc dot gnu.org 2020-08-04 11:21 ` wilco at gcc dot gnu.org 2020-08-04 11:30 ` jakub at gcc dot gnu.org 2021-01-11 14:44 ` [Bug tree-optimization/95731] Failure " jakub at gcc dot gnu.org 2021-01-12 10:05 ` cvs-commit at gcc dot gnu.org [this message] 2021-01-16 8:42 ` jakub at gcc dot gnu.org 2021-08-14 21:27 ` pinskia at gcc dot gnu.org 2021-08-14 21:28 ` 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-95731-4-yXidyeUVcz@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).