From: Andrew Pinski <apinski@marvell.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Andrew Pinski <apinski@marvell.com>
Subject: [PATCH 2/3] MATCH: Improve zero_one_valued_p by using ssa_name_has_boolean_range
Date: Sat, 2 Sep 2023 08:09:56 -0700 [thread overview]
Message-ID: <20230902150957.845269-2-apinski@marvell.com> (raw)
In-Reply-To: <20230902150957.845269-1-apinski@marvell.com>
Currently zero_one_valued_p uses tree_nonzero_bits which uses
the global ranges of the SSA Names. We can improve this via using
ssa_name_has_boolean_range which uses the local ranges
which are used while handling folding during VRP and other passes.
OK? Bootstrapped and tested on x86_64 with no regressions.
gcc/ChangeLog:
* match.pd (zero_one_valued_p): Match SSA_NAMES where
ssa_name_has_boolean_range returns true.
---
gcc/match.pd | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gcc/match.pd b/gcc/match.pd
index b94d71d2376..04033546fc1 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2063,6 +2063,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
/* zero_one_valued_p will match when a value is known to be either
0 or 1 including constants 0 or 1.
Signed 1-bits includes -1 so they cannot match here. */
+/* Note ssa_name_has_boolean_range uses
+ the current ranger while tree_nonzero_bits uses only
+ the global one. */
+(match zero_one_valued_p
+ SSA_NAME@0
+ (if (ssa_name_has_boolean_range (@0))))
(match zero_one_valued_p
@0
(if (INTEGRAL_TYPE_P (type)
--
2.31.1
next prev parent reply other threads:[~2023-09-02 15:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-02 15:09 [PATCH 1/3] Improve ssa_name_has_boolean_range slightly Andrew Pinski
2023-09-02 15:09 ` Andrew Pinski [this message]
2023-09-05 6:59 ` [PATCH 2/3] MATCH: Improve zero_one_valued_p by using ssa_name_has_boolean_range Jeff Law
2023-09-02 15:09 ` [PATCH 3/3] MATCH: Replace all uses of ssa_name_has_boolean_range with zero_one_valued_p Andrew Pinski
2023-09-05 7:02 ` Jeff Law
2023-09-05 6:58 ` [PATCH 1/3] Improve ssa_name_has_boolean_range slightly Jeff Law
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=20230902150957.845269-2-apinski@marvell.com \
--to=apinski@marvell.com \
--cc=gcc-patches@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: link
Be 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).