mirror of https://github.com/gcc-mirror/gcc.git
Cleanup prange sanity checks.
The pointers_handled_p() code was a temporary sanity check, and not even a good one, since we have a cleaner way of checking type mismatches with operand_check_p. This patch removes all the code, and adds an explicit type check for relational operators, which are the main problem in PR114985. Adding this check makes it clear where the type mismatch is happening in IPA, even without prange. I've added code to skip the range folding if the types don't match what the operator expects. In order to reproduce the latent bug, just remove the operand_check_p calls. Tested on x86-64 and ppc64le with and without prange support. gcc/ChangeLog: PR tree-optimization/114985 * gimple-range-op.cc: Remove pointers_handled_p. * ipa-cp.cc (ipa_value_range_from_jfunc): Skip range folding if operands don't match. (propagate_vr_across_jump_function): Same. * range-op-mixed.h: Remove pointers_handled_p and tweak operand_check_p. * range-op-ptr.cc (range_operator::pointers_handled_p): Remove. (pointer_plus_operator::pointers_handled_p): Remove. (class operator_pointer_diff): Remove pointers_handled_p. (operator_pointer_diff::pointers_handled_p): Remove. (operator_identity::pointers_handled_p): Remove. (operator_cst::pointers_handled_p): Remove. (operator_cast::pointers_handled_p): Remove. (operator_min::pointers_handled_p): Remove. (operator_max::pointers_handled_p): Remove. (operator_addr_expr::pointers_handled_p): Remove. (operator_bitwise_and::pointers_handled_p): Remove. (operator_bitwise_or::pointers_handled_p): Remove. (operator_equal::pointers_handled_p): Remove. (operator_not_equal::pointers_handled_p): Remove. (operator_lt::pointers_handled_p): Remove. (operator_le::pointers_handled_p): Remove. (operator_gt::pointers_handled_p): Remove. (operator_ge::pointers_handled_p): Remove. * range-op.cc (TRAP_ON_UNHANDLED_POINTER_OPERATORS): Remove. (range_op_handler::lhs_op1_relation): Remove pointers_handled_p checks. (range_op_handler::lhs_op2_relation): Same. (range_op_handler::op1_op2_relation): Same. * range-op.h: Remove RO_* declarations.pull/91/merge
parent
f6bed6d3fc
commit
b8e3574e68
|
@ -329,19 +329,6 @@ public:
|
|||
r = lhs;
|
||||
return true;
|
||||
}
|
||||
virtual bool pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_PPP;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
return dispatch == RO_PPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} op_cfn_pass_through_arg1;
|
||||
|
||||
// Implement range operator for CFN_BUILT_IN_SIGNBIT.
|
||||
|
@ -1132,17 +1119,6 @@ public:
|
|||
r.set (type, wi::zero (TYPE_PRECISION (type)), max - 2);
|
||||
return true;
|
||||
}
|
||||
virtual bool pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_IPI;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} op_cfn_strlen;
|
||||
|
||||
|
||||
|
|
|
@ -1740,6 +1740,11 @@ ipa_value_range_from_jfunc (vrange &vr,
|
|||
|
||||
if (!handler
|
||||
|| !op_res.supports_type_p (vr_type)
|
||||
/* Sometimes we try to fold comparison operators using a
|
||||
pointer type to hold the result instead of a boolean
|
||||
type. Avoid trapping in the sanity check in
|
||||
fold_range until this is fixed. */
|
||||
|| !handler.operand_check_p (vr_type, srcvr.type (), op_vr.type ())
|
||||
|| !handler.fold_range (op_res, vr_type, srcvr, op_vr))
|
||||
op_res.set_varying (vr_type);
|
||||
|
||||
|
@ -2547,6 +2552,13 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
|
|||
|
||||
if (!handler
|
||||
|| !ipa_supports_p (operand_type)
|
||||
/* Sometimes we try to fold comparison operators using a
|
||||
pointer type to hold the result instead of a boolean
|
||||
type. Avoid trapping in the sanity check in
|
||||
fold_range until this is fixed. */
|
||||
|| !handler.operand_check_p (operand_type,
|
||||
src_lats->m_value_range.m_vr.type (),
|
||||
op_vr.type ())
|
||||
|| !handler.fold_range (op_res, operand_type,
|
||||
src_lats->m_value_range.m_vr, op_vr))
|
||||
op_res.set_varying (param_type);
|
||||
|
|
|
@ -151,9 +151,8 @@ public:
|
|||
void update_bitmask (irange &r, const irange &lh,
|
||||
const irange &rh) const final override;
|
||||
// Check op1 and op2 for compatibility.
|
||||
bool operand_check_p (tree, tree t1, tree t2) const final override
|
||||
{ return range_compatible_p (t1, t2); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t2, t3) && INTEGRAL_TYPE_P (t1); }
|
||||
};
|
||||
|
||||
class operator_not_equal : public range_operator
|
||||
|
@ -203,9 +202,8 @@ public:
|
|||
void update_bitmask (irange &r, const irange &lh,
|
||||
const irange &rh) const final override;
|
||||
// Check op1 and op2 for compatibility.
|
||||
bool operand_check_p (tree, tree t1, tree t2) const final override
|
||||
{ return range_compatible_p (t1, t2); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
bool operand_check_p (tree t0, tree t1, tree t2) const final override
|
||||
{ return range_compatible_p (t1, t2) && INTEGRAL_TYPE_P (t0); }
|
||||
};
|
||||
|
||||
class operator_lt : public range_operator
|
||||
|
@ -252,9 +250,8 @@ public:
|
|||
void update_bitmask (irange &r, const irange &lh,
|
||||
const irange &rh) const final override;
|
||||
// Check op1 and op2 for compatibility.
|
||||
bool operand_check_p (tree, tree t1, tree t2) const final override
|
||||
{ return range_compatible_p (t1, t2); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t2, t3) && INTEGRAL_TYPE_P (t1); }
|
||||
};
|
||||
|
||||
class operator_le : public range_operator
|
||||
|
@ -304,9 +301,8 @@ public:
|
|||
void update_bitmask (irange &r, const irange &lh,
|
||||
const irange &rh) const final override;
|
||||
// Check op1 and op2 for compatibility.
|
||||
bool operand_check_p (tree, tree t1, tree t2) const final override
|
||||
{ return range_compatible_p (t1, t2); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t2, t3) && INTEGRAL_TYPE_P (t1); }
|
||||
};
|
||||
|
||||
class operator_gt : public range_operator
|
||||
|
@ -355,9 +351,8 @@ public:
|
|||
void update_bitmask (irange &r, const irange &lh,
|
||||
const irange &rh) const final override;
|
||||
// Check op1 and op2 for compatibility.
|
||||
bool operand_check_p (tree, tree t1, tree t2) const final override
|
||||
{ return range_compatible_p (t1, t2); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t2, t3) && INTEGRAL_TYPE_P (t1); }
|
||||
};
|
||||
|
||||
class operator_ge : public range_operator
|
||||
|
@ -407,9 +402,8 @@ public:
|
|||
void update_bitmask (irange &r, const irange &lh,
|
||||
const irange &rh) const final override;
|
||||
// Check op1 and op2 for compatibility.
|
||||
bool operand_check_p (tree, tree t1, tree t2) const final override
|
||||
{ return range_compatible_p (t1, t2); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t2, t3) && INTEGRAL_TYPE_P (t1); }
|
||||
};
|
||||
|
||||
class operator_identity : public range_operator
|
||||
|
@ -442,7 +436,6 @@ public:
|
|||
relation_kind lhs_op1_relation (const prange &lhs,
|
||||
const prange &op1, const prange &op2,
|
||||
relation_kind rel) const final override;
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
};
|
||||
|
||||
class operator_cst : public range_operator
|
||||
|
@ -458,7 +451,6 @@ public:
|
|||
bool fold_range (frange &r, tree type,
|
||||
const frange &op1, const frange &op2,
|
||||
relation_trio = TRIO_VARYING) const final override;
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -507,7 +499,6 @@ public:
|
|||
relation_kind) const final override;
|
||||
void update_bitmask (irange &r, const irange &lh,
|
||||
const irange &rh) const final override;
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
private:
|
||||
bool truncating_cast_p (const irange &inner, const irange &outer) const;
|
||||
bool inside_domain_p (const wide_int &min, const wide_int &max,
|
||||
|
@ -730,7 +721,6 @@ public:
|
|||
bool op1_range (prange &r, tree type,
|
||||
const prange &lhs, const prange &op2,
|
||||
relation_trio rel = TRIO_VARYING) const final override;
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
};
|
||||
|
||||
class operator_bitwise_not : public range_operator
|
||||
|
@ -807,7 +797,6 @@ public:
|
|||
// Check compatibility of all operands.
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
protected:
|
||||
void wi_fold (irange &r, tree type, const wide_int &lh_lb,
|
||||
const wide_int &lh_ub, const wide_int &rh_lb,
|
||||
|
@ -834,7 +823,6 @@ public:
|
|||
// Check compatibility of all operands.
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
protected:
|
||||
void wi_fold (irange &r, tree type, const wide_int &lh_lb,
|
||||
const wide_int &lh_ub, const wide_int &rh_lb,
|
||||
|
@ -855,7 +843,6 @@ public:
|
|||
// Check compatibility of all operands.
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
protected:
|
||||
void wi_fold (irange &r, tree type, const wide_int &lh_lb,
|
||||
const wide_int &lh_ub, const wide_int &rh_lb,
|
||||
|
@ -876,7 +863,6 @@ public:
|
|||
// Check compatibility of all operands.
|
||||
bool operand_check_p (tree t1, tree t2, tree t3) const final override
|
||||
{ return range_compatible_p (t1, t2) && range_compatible_p (t1, t3); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
protected:
|
||||
void wi_fold (irange &r, tree type, const wide_int &lh_lb,
|
||||
const wide_int &lh_ub, const wide_int &rh_lb,
|
||||
|
|
|
@ -49,18 +49,6 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree-ssa-ccp.h"
|
||||
#include "range-op-mixed.h"
|
||||
|
||||
// Return TRUE if a range-op folder TYPE either handles or can safely
|
||||
// ignore the dispatch pattern in DISPATCH. Return FALSE for any
|
||||
// combination not handled, which will result in a hard fail up the
|
||||
// chain.
|
||||
|
||||
bool
|
||||
range_operator::pointers_handled_p (range_op_dispatch_type ATTRIBUTE_UNUSED,
|
||||
unsigned dispatch ATTRIBUTE_UNUSED) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
range_operator::fold_range (prange &, tree, const prange &, const prange &,
|
||||
relation_trio) const
|
||||
|
@ -323,7 +311,6 @@ public:
|
|||
const irange &lhs,
|
||||
const irange &op1,
|
||||
relation_trio = TRIO_VARYING) const;
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
void update_bitmask (irange &r, const irange &lh, const irange &rh) const
|
||||
{ update_known_bitmask (r, POINTER_PLUS_EXPR, lh, rh); }
|
||||
} op_pointer_plus;
|
||||
|
@ -401,21 +388,6 @@ pointer_plus_operator::op2_range (irange &r, tree type,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
pointer_plus_operator::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_PPI;
|
||||
case DISPATCH_OP2_RANGE:
|
||||
return dispatch == RO_IPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pointer_plus_operator::wi_fold (irange &r, tree type,
|
||||
const wide_int &lh_lb,
|
||||
|
@ -612,7 +584,6 @@ class operator_pointer_diff : public range_operator
|
|||
void update_bitmask (irange &r,
|
||||
const prange &lh, const prange &rh) const final override
|
||||
{ update_known_bitmask (r, POINTER_DIFF_EXPR, lh, rh); }
|
||||
bool pointers_handled_p (range_op_dispatch_type, unsigned) const final override;
|
||||
} op_pointer_diff;
|
||||
|
||||
bool
|
||||
|
@ -631,13 +602,6 @@ operator_pointer_diff::op1_op2_relation_effect (irange &lhs_range, tree type,
|
|||
return minus_op1_op2_relation_effect (lhs_range, type, op1, op2, rel);
|
||||
}
|
||||
|
||||
bool
|
||||
operator_pointer_diff::pointers_handled_p (range_op_dispatch_type,
|
||||
unsigned) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_pointer_diff::op1_op2_relation_effect (irange &lhs_range, tree type,
|
||||
const irange &op1_range,
|
||||
|
@ -836,21 +800,6 @@ operator_identity::op1_range (prange &r, tree type ATTRIBUTE_UNUSED,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_identity::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
case DISPATCH_OP1_RANGE:
|
||||
case DISPATCH_LHS_OP1_RELATION:
|
||||
return dispatch == RO_PPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_cst::fold_range (prange &r, tree type ATTRIBUTE_UNUSED,
|
||||
const prange &lh,
|
||||
|
@ -861,19 +810,6 @@ operator_cst::fold_range (prange &r, tree type ATTRIBUTE_UNUSED,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_cst::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_PPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Cast between pointers.
|
||||
|
||||
bool
|
||||
|
@ -1099,26 +1035,6 @@ operator_cast::lhs_op1_relation (const irange &lhs,
|
|||
return bits_to_pe (prec);
|
||||
}
|
||||
|
||||
bool
|
||||
operator_cast::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
case DISPATCH_OP1_RANGE:
|
||||
return (dispatch == RO_PPP
|
||||
|| dispatch == RO_IPI
|
||||
|| dispatch == RO_PIP);
|
||||
case DISPATCH_LHS_OP1_RELATION:
|
||||
return (dispatch == RO_PPP
|
||||
|| dispatch == RO_PII
|
||||
|| dispatch == RO_IPP);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_min::fold_range (prange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1141,19 +1057,6 @@ operator_min::fold_range (prange &r, tree type,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_min::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_PPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_max::fold_range (prange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1176,19 +1079,6 @@ operator_max::fold_range (prange &r, tree type,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_max::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_PPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_addr_expr::op1_range (prange &r, tree type,
|
||||
const prange &lhs,
|
||||
|
@ -1210,23 +1100,6 @@ operator_addr_expr::op1_range (prange &r, tree type,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_addr_expr::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
// NOTE: It looks like we never generate this combination.
|
||||
gcc_unreachable ();
|
||||
return false;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
return dispatch == RO_PPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_bitwise_and::fold_range (prange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1244,30 +1117,6 @@ operator_bitwise_and::fold_range (prange &r, tree type,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_bitwise_and::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_PPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_bitwise_or::pointers_handled_p (range_op_dispatch_type,
|
||||
unsigned) const
|
||||
{
|
||||
// NOTE: It looks like we never generate bitwise OR with pointers.
|
||||
// If this is indeed the case, we can move operator_bitwise_or from
|
||||
// range-op-mixed.h to range-op.h.
|
||||
gcc_unreachable ();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_equal::fold_range (irange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1367,24 +1216,6 @@ operator_equal::op1_op2_relation (const irange &lhs, const prange &,
|
|||
return VREL_VARYING;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_equal::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_IPP;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
case DISPATCH_OP2_RANGE:
|
||||
return dispatch == RO_PIP;
|
||||
case DISPATCH_OP1_OP2_RELATION:
|
||||
return dispatch == RO_IPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_not_equal::fold_range (irange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1485,24 +1316,6 @@ operator_not_equal::op1_op2_relation (const irange &lhs, const prange &,
|
|||
return VREL_VARYING;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_not_equal::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_IPP;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
case DISPATCH_OP2_RANGE:
|
||||
return dispatch == RO_PIP;
|
||||
case DISPATCH_OP1_OP2_RELATION:
|
||||
return dispatch == RO_IPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_lt::fold_range (irange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1596,24 +1409,6 @@ operator_lt::op1_op2_relation (const irange &lhs, const prange &,
|
|||
return VREL_VARYING;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_lt::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_IPP;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
case DISPATCH_OP2_RANGE:
|
||||
return dispatch == RO_PIP;
|
||||
case DISPATCH_OP1_OP2_RELATION:
|
||||
return dispatch == RO_IPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_le::fold_range (irange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1704,24 +1499,6 @@ operator_le::op1_op2_relation (const irange &lhs, const prange &,
|
|||
return VREL_VARYING;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_le::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_IPP;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
case DISPATCH_OP2_RANGE:
|
||||
return dispatch == RO_PIP;
|
||||
case DISPATCH_OP1_OP2_RELATION:
|
||||
return dispatch == RO_IPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_gt::fold_range (irange &r, tree type,
|
||||
const prange &op1, const prange &op2,
|
||||
|
@ -1810,24 +1587,6 @@ operator_gt::op1_op2_relation (const irange &lhs, const prange &,
|
|||
return VREL_VARYING;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_gt::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_IPP;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
case DISPATCH_OP2_RANGE:
|
||||
return dispatch == RO_PIP;
|
||||
case DISPATCH_OP1_OP2_RELATION:
|
||||
return dispatch == RO_IPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
operator_ge::fold_range (irange &r, tree type,
|
||||
const prange &op1,
|
||||
|
@ -1918,24 +1677,6 @@ operator_ge::op1_op2_relation (const irange &lhs, const prange &,
|
|||
return VREL_VARYING;
|
||||
}
|
||||
|
||||
bool
|
||||
operator_ge::pointers_handled_p (range_op_dispatch_type type,
|
||||
unsigned dispatch) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DISPATCH_FOLD_RANGE:
|
||||
return dispatch == RO_IPP;
|
||||
case DISPATCH_OP1_RANGE:
|
||||
case DISPATCH_OP2_RANGE:
|
||||
return dispatch == RO_PIP;
|
||||
case DISPATCH_OP1_OP2_RELATION:
|
||||
return dispatch == RO_IPP;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize any pointer operators to the primary table
|
||||
|
||||
void
|
||||
|
|
|
@ -49,11 +49,6 @@ along with GCC; see the file COPYING3. If not see
|
|||
#include "tree-ssa-ccp.h"
|
||||
#include "range-op-mixed.h"
|
||||
|
||||
// Set to 1 to trap on range-op entries that cannot handle the pointer
|
||||
// combination being requested. This is a temporary sanity check to
|
||||
// aid in debugging, and will be removed later in the release cycle.
|
||||
#define TRAP_ON_UNHANDLED_POINTER_OPERATORS 0
|
||||
|
||||
// Instantiate the operators which apply to multiple types here.
|
||||
|
||||
operator_equal op_equal;
|
||||
|
@ -238,11 +233,6 @@ range_op_handler::fold_range (vrange &r, tree type,
|
|||
#if CHECKING_P
|
||||
if (!lh.undefined_p () && !rh.undefined_p ())
|
||||
gcc_assert (m_operator->operand_check_p (type, lh.type (), rh.type ()));
|
||||
if (TRAP_ON_UNHANDLED_POINTER_OPERATORS
|
||||
&& has_pointer_operand_p (r, lh, rh)
|
||||
&& !m_operator->pointers_handled_p (DISPATCH_FOLD_RANGE,
|
||||
dispatch_kind (r, lh, rh)))
|
||||
discriminator_fail (r, lh, rh);
|
||||
#endif
|
||||
switch (dispatch_kind (r, lh, rh))
|
||||
{
|
||||
|
@ -305,11 +295,6 @@ range_op_handler::op1_range (vrange &r, tree type,
|
|||
#if CHECKING_P
|
||||
if (!op2.undefined_p ())
|
||||
gcc_assert (m_operator->operand_check_p (lhs.type (), type, op2.type ()));
|
||||
if (TRAP_ON_UNHANDLED_POINTER_OPERATORS
|
||||
&& has_pointer_operand_p (r, lhs, op2)
|
||||
&& !m_operator->pointers_handled_p (DISPATCH_OP1_RANGE,
|
||||
dispatch_kind (r, lhs, op2)))
|
||||
discriminator_fail (r, lhs, op2);
|
||||
#endif
|
||||
switch (dispatch_kind (r, lhs, op2))
|
||||
{
|
||||
|
@ -360,11 +345,6 @@ range_op_handler::op2_range (vrange &r, tree type,
|
|||
#if CHECKING_P
|
||||
if (!op1.undefined_p ())
|
||||
gcc_assert (m_operator->operand_check_p (lhs.type (), op1.type (), type));
|
||||
if (TRAP_ON_UNHANDLED_POINTER_OPERATORS
|
||||
&& has_pointer_operand_p (r, lhs, op1)
|
||||
&& !m_operator->pointers_handled_p (DISPATCH_OP2_RANGE,
|
||||
dispatch_kind (r, lhs, op1)))
|
||||
discriminator_fail (r, lhs, op1);
|
||||
#endif
|
||||
switch (dispatch_kind (r, lhs, op1))
|
||||
{
|
||||
|
@ -402,14 +382,6 @@ range_op_handler::lhs_op1_relation (const vrange &lhs,
|
|||
relation_kind rel) const
|
||||
{
|
||||
gcc_checking_assert (m_operator);
|
||||
#if CHECKING_P
|
||||
if (TRAP_ON_UNHANDLED_POINTER_OPERATORS
|
||||
&& has_pointer_operand_p (lhs, op1, op2)
|
||||
&& !m_operator->pointers_handled_p (DISPATCH_LHS_OP1_RELATION,
|
||||
dispatch_kind (lhs, op1, op2)))
|
||||
discriminator_fail (lhs, op1, op2);
|
||||
#endif
|
||||
|
||||
switch (dispatch_kind (lhs, op1, op2))
|
||||
{
|
||||
case RO_III:
|
||||
|
@ -450,13 +422,6 @@ range_op_handler::lhs_op2_relation (const vrange &lhs,
|
|||
relation_kind rel) const
|
||||
{
|
||||
gcc_checking_assert (m_operator);
|
||||
#if CHECKING_P
|
||||
if (TRAP_ON_UNHANDLED_POINTER_OPERATORS
|
||||
&& has_pointer_operand_p (lhs, op1, op2)
|
||||
&& !m_operator->pointers_handled_p (DISPATCH_LHS_OP2_RELATION,
|
||||
dispatch_kind (lhs, op1, op2)))
|
||||
discriminator_fail (lhs, op1, op2);
|
||||
#endif
|
||||
switch (dispatch_kind (lhs, op1, op2))
|
||||
{
|
||||
case RO_III:
|
||||
|
@ -484,13 +449,7 @@ range_op_handler::op1_op2_relation (const vrange &lhs,
|
|||
const vrange &op2) const
|
||||
{
|
||||
gcc_checking_assert (m_operator);
|
||||
#if CHECKING_P
|
||||
if (TRAP_ON_UNHANDLED_POINTER_OPERATORS
|
||||
&& has_pointer_operand_p (lhs, op1, op2)
|
||||
&& !m_operator->pointers_handled_p (DISPATCH_OP1_OP2_RELATION,
|
||||
dispatch_kind (lhs, op1, op2)))
|
||||
discriminator_fail (lhs, op1, op2);
|
||||
#endif
|
||||
|
||||
switch (dispatch_kind (lhs, op1, op2))
|
||||
{
|
||||
case RO_III:
|
||||
|
|
|
@ -229,7 +229,6 @@ public:
|
|||
|
||||
// Compatability check for operands.
|
||||
virtual bool operand_check_p (tree, tree, tree) const;
|
||||
virtual bool pointers_handled_p (enum range_op_dispatch_type, unsigned) const;
|
||||
|
||||
protected:
|
||||
// Perform an integral operation between 2 sub-ranges and return it.
|
||||
|
@ -411,20 +410,4 @@ protected:
|
|||
void initialize_float_ops ();
|
||||
};
|
||||
|
||||
// Temporary exports so the pointers_handled_p() sanity code can see
|
||||
// which pointer combination is being attempted. This will be deleted
|
||||
// once pointers_handled_p is gone.
|
||||
extern const unsigned RO_III;
|
||||
extern const unsigned RO_IFI;
|
||||
extern const unsigned RO_IFF;
|
||||
extern const unsigned RO_FFF;
|
||||
extern const unsigned RO_FIF;
|
||||
extern const unsigned RO_FII;
|
||||
extern const unsigned RO_PPP;
|
||||
extern const unsigned RO_PPI;
|
||||
extern const unsigned RO_IPP;
|
||||
extern const unsigned RO_IPI;
|
||||
extern const unsigned RO_PIP;
|
||||
extern const unsigned RO_PII;
|
||||
|
||||
#endif // GCC_RANGE_OP_H
|
||||
|
|
Loading…
Reference in New Issue