https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114331

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Aldy Hernandez from comment #6)
> You may want to look at:
> 
> // Return the bitmask inherent in the range.
> 
> irange_bitmask
> irange::get_bitmask_from_range () const
> {
> }
> 
> IIRC, this code was originally authored by Jakub and was embedded in the
> tree-ssanames.cc code setting nonzero bits every time we set a global range.
> I just abstracted it and adapted it to work within our framework.

I'm afraid on this testcase trying to derive bitmask from range is not going to
work if the range is that
[irange] int [-INF, -65537][-65425, -65425][111, 111][65536, +INF]
We really want to record that because of the bb we know that the low 16 bits
are equal to 111 and the upper 16 bits are unknown.
Because the range could help there only if we had a union of 65536 subranges
here.
tree-ssanames.cc before contained just a single mask, so could only track known
zero bits vs. unknown bits rather than known zero bits vs. known one bits vs.
unknown bits.
While MASK 0xffff0000 VALUE 0x6f can represent what supposedly the BIT_AND_EXPR
optimization needs (whether we actually use it then to optimize it away is
another question).

Reply via email to