Message ID | 20230717075645.243653-1-aldyh@redhat.com |
---|---|
State | New |
Headers | show |
Series | Export value/mask known bits from CCP. | expand |
On Mon, Jul 17, 2023 at 9:57 AM Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Currently CCP 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? OK. > gcc/ChangeLog: > > * tree-ssa-ccp.cc (ccp_finalize): Export value/mask known bits. > --- > gcc/tree-ssa-ccp.cc | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc > index 0d0f02a8442..64d5fa81334 100644 > --- a/gcc/tree-ssa-ccp.cc > +++ b/gcc/tree-ssa-ccp.cc > @@ -1020,11 +1020,9 @@ ccp_finalize (bool nonzero_p) > else > { > unsigned int precision = TYPE_PRECISION (TREE_TYPE (val->value)); > - wide_int nonzero_bits > - = (wide_int::from (val->mask, precision, UNSIGNED) > - | wi::to_wide (val->value)); > - nonzero_bits &= get_nonzero_bits (name); > - set_nonzero_bits (name, nonzero_bits); > + wide_int value = wi::to_wide (val->value); > + wide_int mask = wide_int::from (val->mask, precision, UNSIGNED); > + set_bitmask (name, value, mask); > } > } > > -- > 2.40.1 >
diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc index 0d0f02a8442..64d5fa81334 100644 --- a/gcc/tree-ssa-ccp.cc +++ b/gcc/tree-ssa-ccp.cc @@ -1020,11 +1020,9 @@ ccp_finalize (bool nonzero_p) else { unsigned int precision = TYPE_PRECISION (TREE_TYPE (val->value)); - wide_int nonzero_bits - = (wide_int::from (val->mask, precision, UNSIGNED) - | wi::to_wide (val->value)); - nonzero_bits &= get_nonzero_bits (name); - set_nonzero_bits (name, nonzero_bits); + wide_int value = wi::to_wide (val->value); + wide_int mask = wide_int::from (val->mask, precision, UNSIGNED); + set_bitmask (name, value, mask); } }