On Wed, Dec 09, 2020 at 09:03:36AM +0100, Richard Biener wrote: > So maybe do > > > if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE > && TYPE_PRECISION (TREE_TYPE (lhs)) == 1) > > and thus rely on get_range_info for Ada?
So, like this instead (if it passes bootstrap/regtest)? Basically, for non-VR_RANGE just use VARYING min/max manually. The min + 1 != max check will then do the rest. 2020-12-09 Jakub Jelinek <ja...@redhat.com> PR bootstrap/98188 * tree-ssa-phiopt.c (two_value_replacement): Don't special case BOOLEAN_TYPEs for ranges, instead if get_range_info doesn't return VR_RANGE, set min/max to wi::min/max_value. --- gcc/tree-ssa-phiopt.c.jj 2020-12-08 15:43:17.399463613 +0100 +++ gcc/tree-ssa-phiopt.c 2020-12-09 09:39:18.713046374 +0100 @@ -658,13 +658,13 @@ two_value_replacement (basic_block cond_ return false; wide_int min, max; - if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE) + if (get_range_info (lhs, &min, &max) != VR_RANGE) { - min = wi::to_wide (boolean_false_node); - max = wi::to_wide (boolean_true_node); + int prec = TYPE_PRECISION (TREE_TYPE (lhs)); + signop sgn = TYPE_SIGN (TREE_TYPE (lhs)); + min = wi::min_value (prec, sgn); + max = wi::max_value (prec, sgn); } - else if (get_range_info (lhs, &min, &max) != VR_RANGE) - return false; if (min + 1 != max || (wi::to_wide (rhs) != min && wi::to_wide (rhs) != max)) Jakub