https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127073
--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jeffrey A. Law from comment #4) > Conceptually I think this needs to be cleaned up in the gimple optimizers, > probably VRP or CCP. But I don't think Ranger has the concept of "A and B > have no bits in common" which is the key to being able to recognize that all > three forms are equivalent. Post-VRP the unreachables are gone and we lose > that information. Ranger keeps around the nonzero bits now and have for a while. So yes it does have that information. That is `tree_nonzero_bits (a) & tree_nonzero_bits (b) == 0` will work. Or even `vr0.get_nonzero_bits () & vr1.get_nonzero_bits () == 0` (where vr0/vr1 is the range which is gotten from `query->range_of_expr (vr0, treeop0, currently_expanding_gimple_stmt)`).
