diff --git a/gcc/range-op.cc b/gcc/range-op.cc index d1c735ee6aa..f2a863db286 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -366,6 +366,24 @@ range_op_handler::op1_op2_relation (const vrange &lhs) const } } +bool +range_op_handler::overflow_free_p (const vrange &lh, + const vrange &rh, + relation_trio rel) const +{ + gcc_checking_assert (m_operator); + switch (dispatch_kind (lh, lh, rh)) + { + case RO_III: + return m_operator->overflow_free_p(as_a (lh), + as_a (rh), + rel); + default: + return false; + } +} + + // Convert irange bitmasks into a VALUE MASK pair suitable for calling CCP. @@ -688,6 +706,13 @@ range_operator::op1_op2_relation_effect (irange &lhs_range ATTRIBUTE_UNUSED, return false; } +bool +range_operator::overflow_free_p (const irange &, const irange &, + relation_trio) const +{ + return false; +} + // Apply any known bitmask updates based on this operator. void diff --git a/gcc/range-op.h b/gcc/range-op.h index af94c2756a7..db3b03f28a5 100644 --- a/gcc/range-op.h +++ b/gcc/range-op.h @@ -147,6 +147,9 @@ public: virtual relation_kind op1_op2_relation (const irange &lhs) const; virtual relation_kind op1_op2_relation (const frange &lhs) const; + + virtual bool overflow_free_p (const irange &lh, const irange &rh, + relation_trio = TRIO_VARYING) const; protected: // Perform an integral operation between 2 sub-ranges and return it. virtual void wi_fold (irange &r, tree type, @@ -214,6 +217,8 @@ public: const vrange &op2, relation_kind = VREL_VARYING) const; relation_kind op1_op2_relation (const vrange &lhs) const; + bool overflow_free_p (const vrange &lh, const vrange &rh, + relation_trio = TRIO_VARYING) const; protected: unsigned dispatch_kind (const vrange &lhs, const vrange &op1, const vrange& op2) const;