From c6bb413eeb9d13412e8101e3029099d7fd746708 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Fri, 1 Dec 2023 11:15:33 -0500 Subject: Use range_compatible_p in check_operands_p. Instead of directly checking type precision, check_operands_p should invoke range_compatible_p to keep the range checking centralized. * gimple-range-fold.h (range_compatible_p): Relocate. * value-range.h (range_compatible_p): Here. * range-op-mixed.h (operand_equal::operand_check_p): Call range_compatible_p rather than comparing precision. (operand_not_equal::operand_check_p): Ditto. (operand_not_lt::operand_check_p): Ditto. (operand_not_le::operand_check_p): Ditto. (operand_not_gt::operand_check_p): Ditto. (operand_not_ge::operand_check_p): Ditto. (operand_plus::operand_check_p): Ditto. (operand_abs::operand_check_p): Ditto. (operand_minus::operand_check_p): Ditto. (operand_negate::operand_check_p): Ditto. (operand_mult::operand_check_p): Ditto. (operand_bitwise_not::operand_check_p): Ditto. (operand_bitwise_xor::operand_check_p): Ditto. (operand_bitwise_and::operand_check_p): Ditto. (operand_bitwise_or::operand_check_p): Ditto. (operand_min::operand_check_p): Ditto. (operand_max::operand_check_p): Ditto. * range-op.cc (operand_lshift::operand_check_p): Ditto. (operand_rshift::operand_check_p): Ditto. (operand_logical_and::operand_check_p): Ditto. (operand_logical_or::operand_check_p): Ditto. (operand_logical_not::operand_check_p): Ditto. --- gcc/gimple-range-fold.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'gcc/gimple-range-fold.h') diff --git a/gcc/gimple-range-fold.h b/gcc/gimple-range-fold.h index fcbe162..0094b4e3 100644 --- a/gcc/gimple-range-fold.h +++ b/gcc/gimple-range-fold.h @@ -89,18 +89,6 @@ gimple_range_ssa_p (tree exp) return NULL_TREE; } -// Return true if TYPE1 and TYPE2 are compatible range types. - -inline bool -range_compatible_p (tree type1, tree type2) -{ - // types_compatible_p requires conversion in both directions to be useless. - // GIMPLE only requires a cast one way in order to be compatible. - // Ranges really only need the sign and precision to be the same. - return (TYPE_PRECISION (type1) == TYPE_PRECISION (type2) - && TYPE_SIGN (type1) == TYPE_SIGN (type2)); -} - // Source of all operands for fold_using_range and gori_compute. // It abstracts out the source of an operand so it can come from a stmt or // and edge or anywhere a derived class of fur_source wants. -- cgit v1.1