diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2024-05-16 09:47:56 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2024-05-16 11:57:48 +0200 |
commit | b8e3574e68310f68116f157a35d5650600d13718 (patch) | |
tree | fba1698cd3b3cd61db7621c978f0d1315bcf62a5 /gcc/range-op.cc | |
parent | f6bed6d3fcc13880ffa786b6c616e2306efe2bf3 (diff) | |
download | gcc-b8e3574e68310f68116f157a35d5650600d13718.zip gcc-b8e3574e68310f68116f157a35d5650600d13718.tar.gz gcc-b8e3574e68310f68116f157a35d5650600d13718.tar.bz2 |
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.
Diffstat (limited to 'gcc/range-op.cc')
-rw-r--r-- | gcc/range-op.cc | 43 |
1 files changed, 1 insertions, 42 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 6a410ff..852d59c 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -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: |