From ee24da1b983a89b05303f2ac8828dd8cbe28d3b4 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 12 Nov 2020 19:25:59 -0500 Subject: [PATCH] Change range_handler, was Re: Fix gimple_expr_code? Adjust the range_handler to not use gimple_expr_code/type. * gimple-range.h (gimple_range_handler): Use gimple_assign and gimple_cond routines to get type and code. * range-op.cc (range_op_handler): Check for integral types. --- gcc/gimple-range.h | 8 ++++++-- gcc/range-op.cc | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h index 0aa6d4672ee..88d2ada324b 100644 --- a/gcc/gimple-range.h +++ b/gcc/gimple-range.h @@ -97,8 +97,12 @@ extern bool gimple_range_calc_op2 (irange &r, const gimple *s, static inline range_operator * gimple_range_handler (const gimple *s) { - if ((gimple_code (s) == GIMPLE_ASSIGN) || (gimple_code (s) == GIMPLE_COND)) - return range_op_handler (gimple_expr_code (s), gimple_expr_type (s)); + if (gimple_code (s) == GIMPLE_ASSIGN) + return range_op_handler (gimple_assign_rhs_code (s), + TREE_TYPE (gimple_assign_lhs (s))); + if (gimple_code (s) == GIMPLE_COND) + return range_op_handler (gimple_cond_code (s), + TREE_TYPE (gimple_cond_lhs (s))); return NULL; } diff --git a/gcc/range-op.cc b/gcc/range-op.cc index aff9383d936..86d1af7fe54 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -3341,10 +3341,12 @@ pointer_table::pointer_table () range_operator * range_op_handler (enum tree_code code, tree type) { - // First check if there is apointer specialization. + // First check if there is a pointer specialization. if (POINTER_TYPE_P (type)) return pointer_tree_table[code]; - return integral_tree_table[code]; + if (INTEGRAL_TYPE_P (type)) + return integral_tree_table[code]; + return NULL; } // Cast the range in R to TYPE. -- 2.30.2