public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Export value/mask known bits from IPA.
@ 2023-07-17  7:58 Aldy Hernandez
  2023-07-17  9:37 ` Martin Jambor
  0 siblings, 1 reply; 2+ messages in thread
From: Aldy Hernandez @ 2023-07-17  7:58 UTC (permalink / raw)
  To: GCC patches; +Cc: Andrew MacLeod, Martin Jambor, Aldy Hernandez

Currently IPA throws away the known 1 bits because VRP and irange have
traditionally only had a way of tracking known 0s (set_nonzero_bits).
With the ability to keep all the known bits in the irange, we can now
save this between passes.

OK?

gcc/ChangeLog:

	* ipa-prop.cc (ipcp_update_bits): Export value/mask known bits.
---
 gcc/ipa-prop.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index d2b998f8af5..5d790ff1265 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -5853,10 +5853,9 @@ ipcp_update_bits (struct cgraph_node *node, ipcp_transformation *ts)
 	{
 	  unsigned prec = TYPE_PRECISION (TREE_TYPE (ddef));
 	  signop sgn = TYPE_SIGN (TREE_TYPE (ddef));
-
-	  wide_int nonzero_bits = wide_int::from (bits[i]->mask, prec, UNSIGNED)
-				  | wide_int::from (bits[i]->value, prec, sgn);
-	  set_nonzero_bits (ddef, nonzero_bits);
+	  wide_int mask = wide_int::from (bits[i]->mask, prec, UNSIGNED);
+	  wide_int value = wide_int::from (bits[i]->value, prec, sgn);
+	  set_bitmask (ddef, value, mask);
 	}
       else
 	{
-- 
2.40.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Export value/mask known bits from IPA.
  2023-07-17  7:58 [PATCH] Export value/mask known bits from IPA Aldy Hernandez
@ 2023-07-17  9:37 ` Martin Jambor
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Jambor @ 2023-07-17  9:37 UTC (permalink / raw)
  To: Aldy Hernandez, GCC patches; +Cc: Andrew MacLeod

Hi Aldy,

On Mon, Jul 17 2023, Aldy Hernandez wrote:
> Currently IPA throws away the known 1 bits because VRP and irange have
> traditionally only had a way of tracking known 0s (set_nonzero_bits).
> With the ability to keep all the known bits in the irange, we can now
> save this between passes.
>
> OK?
>
> gcc/ChangeLog:
>
> 	* ipa-prop.cc (ipcp_update_bits): Export value/mask known bits.

OK, thanks.

Martin


> ---
>  gcc/ipa-prop.cc | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
> index d2b998f8af5..5d790ff1265 100644
> --- a/gcc/ipa-prop.cc
> +++ b/gcc/ipa-prop.cc
> @@ -5853,10 +5853,9 @@ ipcp_update_bits (struct cgraph_node *node, ipcp_transformation *ts)
>  	{
>  	  unsigned prec = TYPE_PRECISION (TREE_TYPE (ddef));
>  	  signop sgn = TYPE_SIGN (TREE_TYPE (ddef));
> -
> -	  wide_int nonzero_bits = wide_int::from (bits[i]->mask, prec, UNSIGNED)
> -				  | wide_int::from (bits[i]->value, prec, sgn);
> -	  set_nonzero_bits (ddef, nonzero_bits);
> +	  wide_int mask = wide_int::from (bits[i]->mask, prec, UNSIGNED);
> +	  wide_int value = wide_int::from (bits[i]->value, prec, sgn);
> +	  set_bitmask (ddef, value, mask);
>  	}
>        else
>  	{
> -- 
> 2.40.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-17  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17  7:58 [PATCH] Export value/mask known bits from IPA Aldy Hernandez
2023-07-17  9:37 ` Martin Jambor

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).