diff mbox series

Export value/mask known bits from IPA.

Message ID 20230717075834.244277-1-aldyh@redhat.com
State New
Headers show
Series Export value/mask known bits from IPA. | expand

Commit Message

Aldy Hernandez July 17, 2023, 7:58 a.m. UTC
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(-)

Comments

Martin Jambor July 17, 2023, 9:37 a.m. UTC | #1
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
diff mbox series

Patch

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
 	{