aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2023-03-02 23:37:20 +0100
committerAldy Hernandez <aldyh@redhat.com>2023-05-01 08:33:16 +0200
commit178abecaa9ca96acee6e155261d4dc50dd98fab4 (patch)
treedff34f1b8545cea5b5113879ce25a80945367afa /gcc/tree-vrp.cc
parentc92b8be9b52b7e0de5ad67bc268dad1498181908 (diff)
downloadgcc-178abecaa9ca96acee6e155261d4dc50dd98fab4.zip
gcc-178abecaa9ca96acee6e155261d4dc50dd98fab4.tar.gz
gcc-178abecaa9ca96acee6e155261d4dc50dd98fab4.tar.bz2
Cleanup irange::set.
Now that anti-ranges are no more and iranges contain wide_ints instead of trees, various cleanups are possible. This is one of a handful of patches improving the performance of irange::set() which is not on a hot path, but quite sensitive because it is so pervasive. gcc/ChangeLog: * gimple-range-op.cc (cfn_ffs::fold_range): Use the correct precision. * gimple-ssa-warn-alloca.cc (alloca_call_type): Use <2> for invalid_range, as it is an inverse range. * tree-vrp.cc (find_case_label_range): Avoid trees. * value-range.cc (irange::irange_set): Delete. (irange::irange_set_1bit_anti_range): Delete. (irange::irange_set_anti_range): Delete. (irange::set): Cleanup. * value-range.h (class irange): Remove irange_set, irange_set_anti_range, irange_set_1bit_anti_range. (irange::set_undefined): Remove set to m_type.
Diffstat (limited to 'gcc/tree-vrp.cc')
-rw-r--r--gcc/tree-vrp.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
index d28637b..0761b68 100644
--- a/gcc/tree-vrp.cc
+++ b/gcc/tree-vrp.cc
@@ -827,6 +827,8 @@ find_case_label_range (gswitch *switch_stmt, const irange *range_of_op)
size_t i, j;
tree op = gimple_switch_index (switch_stmt);
tree type = TREE_TYPE (op);
+ unsigned prec = TYPE_PRECISION (type);
+ signop sign = TYPE_SIGN (type);
tree tmin = wide_int_to_tree (type, range_of_op->lower_bound ());
tree tmax = wide_int_to_tree (type, range_of_op->upper_bound ());
find_case_label_range (switch_stmt, tmin, tmax, &i, &j);
@@ -837,9 +839,11 @@ find_case_label_range (gswitch *switch_stmt, const irange *range_of_op)
tree label = gimple_switch_label (switch_stmt, i);
tree case_high
= CASE_HIGH (label) ? CASE_HIGH (label) : CASE_LOW (label);
+ wide_int wlow = wi::to_wide (CASE_LOW (label));
+ wide_int whigh = wi::to_wide (case_high);
int_range_max label_range (type,
- wi::to_wide (CASE_LOW (label)),
- wi::to_wide (case_high));
+ wide_int::from (wlow, prec, sign),
+ wide_int::from (whigh, prec, sign));
if (!types_compatible_p (label_range.type (), range_of_op->type ()))
range_cast (label_range, range_of_op->type ());
label_range.intersect (*range_of_op);