https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127073
--- Comment #6 from Drea Pinski <pinskia at gcc dot gnu.org> --- (In reply to Drea Pinski from comment #5) > (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)`). But yes in this case, we do remove the unreachables during the last forwprop (moved there in r16-4202-g415f21fed2c541). Though we might be able to move that later in isel. Where we also say replace +/|/^ in the case where we know the operands don't share bits with an internal function for the new optab.
