diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2022-07-12 10:16:03 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2022-07-12 16:40:51 +0200 |
commit | cab411a2b4b4f6a6b619d0650fade85288a31f9e (patch) | |
tree | 20ef2d8a96f990a4565e1153b78bb7f4179eb8e0 /gcc/value-range.cc | |
parent | 32a753506be1d5265b657b4b80aeeae57871bb4c (diff) | |
download | gcc-cab411a2b4b4f6a6b619d0650fade85288a31f9e.zip gcc-cab411a2b4b4f6a6b619d0650fade85288a31f9e.tar.gz gcc-cab411a2b4b4f6a6b619d0650fade85288a31f9e.tar.bz2 |
Set nonzero bits from bitwise and operator in range-ops.
Now that nonzero bits are first class citizens in the range, we can
keep better track of them in range-ops, especially the bitwise and
operator.
This patch sets the nonzero mask for the trivial case. In doing so,
I've removed some old dead code that was an attempt to keep better
track of masks.
I'm sure there are tons of optimizations throughout range-ops that
could be implemented, especially the op1_range methods, but those
always make my head hurt. I'll leave them to the smarter hackers
out there.
I've removed the restriction that nonzero bits can't be queried from
legacy. This was causing special casing all over the place, and
it's not like we can generate incorrect code. We just silently
drop nonzero bits to -1 in some of the legacy code. The end result
is that VRP1, and other users of legacy, may not benefit from these
improvements.
Tested and benchmarked on x86-64 Linux.
gcc/ChangeLog:
* range-op.cc (unsigned_singleton_p): Remove.
(operator_bitwise_and::remove_impossible_ranges): Remove.
(operator_bitwise_and::fold_range): Set nonzero bits. *
* value-range.cc (irange::get_nonzero_bits): Remove
legacy_mode_p assert.
(irange::dump_bitmasks): Remove legacy_mode_p check.
Diffstat (limited to 'gcc/value-range.cc')
-rw-r--r-- | gcc/value-range.cc | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/gcc/value-range.cc b/gcc/value-range.cc index a02fab4..2aa973b 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -2388,10 +2388,6 @@ wide_int irange::get_nonzero_bits () const { gcc_checking_assert (!undefined_p ()); - // Nonzero bits are unsupported in legacy mode. The mask may be set - // as a consequence of propagation or reading global ranges, but no - // one from legacy land should be querying this. - gcc_checking_assert (!legacy_mode_p ()); // Calculate the nonzero bits inherent in the range. wide_int min = lower_bound (); @@ -2509,7 +2505,7 @@ irange::dump (FILE *file) const void irange::dump_bitmasks (FILE *file) const { - if (m_nonzero_mask && !legacy_mode_p ()) + if (m_nonzero_mask) { wide_int nz = get_nonzero_bits (); if (nz != -1) |