Add some missing overrides, and add the diaptch pattern for FII which
will be used for integer to float conversion.
Bootstraps on x86_64-pc-linux-gnu with no regressions. Pushed.
Andrew
From 1bed4b49302e2fd7bf89426117331ae89ebdc90b Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacl...@redhat.com>
Date: Mon, 12 Jun 2023 09:47:43 -0400
Subject: [PATCH 17/17] Add some overrides.
PR tree-optimization/110205
* range-op-float.cc (range_operator::fold_range): Add default FII
fold routine.
(Class operator_gt): Add missing final overrides.
* range-op.cc (range_op_handler::fold_range): Add RO_FII case.
(operator_lshift ::update_bitmask): Add final override.
(operator_rshift ::update_bitmask): Add final override.
* range-op.h (range_operator::fold_range): Add FII prototype.
---
gcc/range-op-float.cc | 10 ++++++++++
gcc/range-op-mixed.h | 9 +++++----
gcc/range-op.cc | 10 ++++++++--
gcc/range-op.h | 4 ++++
4 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 24f2235884f..f5c0cec75c4 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -157,6 +157,16 @@ range_operator::fold_range (irange &r ATTRIBUTE_UNUSED,
return false;
}
+bool
+range_operator::fold_range (frange &r ATTRIBUTE_UNUSED,
+ tree type ATTRIBUTE_UNUSED,
+ const irange &lh ATTRIBUTE_UNUSED,
+ const irange &rh ATTRIBUTE_UNUSED,
+ relation_trio) const
+{
+ return false;
+}
+
bool
range_operator::op1_range (frange &r ATTRIBUTE_UNUSED,
tree type ATTRIBUTE_UNUSED,
diff --git a/gcc/range-op-mixed.h b/gcc/range-op-mixed.h
index bdc488b8754..6944742ecbc 100644
--- a/gcc/range-op-mixed.h
+++ b/gcc/range-op-mixed.h
@@ -239,26 +239,27 @@ public:
using range_operator::op1_op2_relation;
bool fold_range (irange &r, tree type,
const irange &op1, const irange &op2,
- relation_trio = TRIO_VARYING) const;
+ relation_trio = TRIO_VARYING) const final override;
bool fold_range (irange &r, tree type,
const frange &op1, const frange &op2,
relation_trio = TRIO_VARYING) const final override;
bool op1_range (irange &r, tree type,
const irange &lhs, const irange &op2,
- relation_trio = TRIO_VARYING) const;
+ relation_trio = TRIO_VARYING) const final override;
bool op1_range (frange &r, tree type,
const irange &lhs, const frange &op2,
relation_trio = TRIO_VARYING) const final override;
bool op2_range (irange &r, tree type,
const irange &lhs, const irange &op1,
- relation_trio = TRIO_VARYING) const;
+ relation_trio = TRIO_VARYING) const final override;
bool op2_range (frange &r, tree type,
const irange &lhs, const frange &op1,
relation_trio = TRIO_VARYING) const final override;
relation_kind op1_op2_relation (const irange &lhs) const final override;
- void update_bitmask (irange &r, const irange &lh, const irange &rh) const;
+ void update_bitmask (irange &r, const irange &lh,
+ const irange &rh) const final override;
};
class operator_ge : public range_operator
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 8a661fdb042..f0dff53ec1e 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -219,6 +219,10 @@ range_op_handler::fold_range (vrange &r, tree type,
return m_operator->fold_range (as_a <frange> (r), type,
as_a <frange> (lh),
as_a <frange> (rh), rel);
+ case RO_FII:
+ return m_operator->fold_range (as_a <frange> (r), type,
+ as_a <irange> (lh),
+ as_a <irange> (rh), rel);
default:
return false;
}
@@ -2401,7 +2405,8 @@ public:
tree type,
const wide_int &,
const wide_int &) const;
- void update_bitmask (irange &r, const irange &lh, const irange &rh) const
+ void update_bitmask (irange &r, const irange &lh,
+ const irange &rh) const final override
{ update_known_bitmask (r, LSHIFT_EXPR, lh, rh); }
} op_lshift;
@@ -2432,7 +2437,8 @@ public:
const irange &op1,
const irange &op2,
relation_kind rel) const;
- void update_bitmask (irange &r, const irange &lh, const irange &rh) const
+ void update_bitmask (irange &r, const irange &lh,
+ const irange &rh) const final override
{ update_known_bitmask (r, RSHIFT_EXPR, lh, rh); }
} op_rshift;
diff --git a/gcc/range-op.h b/gcc/range-op.h
index 3602bc4e123..af94c2756a7 100644
--- a/gcc/range-op.h
+++ b/gcc/range-op.h
@@ -72,6 +72,10 @@ public:
const frange &lh,
const frange &rh,
relation_trio = TRIO_VARYING) const;
+ virtual bool fold_range (frange &r, tree type,
+ const irange &lh,
+ const irange &rh,
+ relation_trio = TRIO_VARYING) const;
// Return the range for op[12] in the general case. LHS is the range for
// the LHS of the expression, OP[12]is the range for the other
--
2.40.1