public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1463] Misc conversions to vrange.
@ 2022-07-04 18:45 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-07-04 18:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ce8dbe7d834b9264d7a5cd74d3ce6c750d28b3af
commit r13-1463-gce8dbe7d834b9264d7a5cd74d3ce6c750d28b3af
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Mon Jul 4 17:32:07 2022 +0200
Misc conversions to vrange.
The following converts a handful of places that were irange centric.
Tested on x86-64 Linux.
gcc/ChangeLog:
* gimple-range-fold.cc
(fold_using_range::range_of_ssa_name_with_loop_info): Restrict the
call to SCEV for irange supported types.
(fold_using_range::range_of_builtin_int_call): Convert to vrange.
* gimple-range.cc (gimple_ranger::prefill_stmt_dependencies): Same.
* tree-ssa-dom.cc (cprop_operand): Same.
Diff:
---
gcc/gimple-range-fold.cc | 32 ++++++++++++++++++--------------
gcc/gimple-range.cc | 11 ++++++++---
gcc/tree-ssa-dom.cc | 2 +-
3 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index 0f815b50b9a..6f907df5bf5 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -1006,19 +1006,21 @@ fold_using_range::range_of_builtin_int_call (irange &r, gcall *call,
switch (func)
{
case CFN_BUILT_IN_CONSTANT_P:
- arg = gimple_call_arg (call, 0);
- if (src.get_operand (r, arg) && r.singleton_p ())
- {
- r.set (build_one_cst (type), build_one_cst (type));
- return true;
- }
- if (cfun->after_inlining)
- {
- r.set_zero (type);
- // r.equiv_clear ();
- return true;
- }
- break;
+ {
+ arg = gimple_call_arg (call, 0);
+ Value_Range tmp (TREE_TYPE (arg));
+ if (src.get_operand (tmp, arg) && tmp.singleton_p ())
+ {
+ r.set (build_one_cst (type), build_one_cst (type));
+ return true;
+ }
+ if (cfun->after_inlining)
+ {
+ r.set_zero (type);
+ return true;
+ }
+ break;
+ }
case CFN_BUILT_IN_TOUPPER:
{
@@ -1335,7 +1337,9 @@ fold_using_range::range_of_ssa_name_with_loop_info (irange &r, tree name,
{
gcc_checking_assert (TREE_CODE (name) == SSA_NAME);
tree min, max, type = TREE_TYPE (name);
- if (bounds_of_var_in_loop (&min, &max, src.query (), l, phi, name))
+ // FIXME: Remove the supports_p() once all this can handle floats, etc.
+ if (irange::supports_p (type)
+ && bounds_of_var_in_loop (&min, &max, src.query (), l, phi, name))
{
if (TREE_CODE (min) != INTEGER_CST)
{
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index f3a46555f91..3a9f0b07e79 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -422,12 +422,17 @@ gimple_ranger::prefill_stmt_dependencies (tree ssa)
{
gcc_checking_assert (range_op_handler (stmt));
tree op = gimple_range_operand2 (stmt);
- Value_Range r (TREE_TYPE (name));
if (op)
- prefill_name (r, op);
+ {
+ Value_Range r (TREE_TYPE (op));
+ prefill_name (r, op);
+ }
op = gimple_range_operand1 (stmt);
if (op)
- prefill_name (r, op);
+ {
+ Value_Range r (TREE_TYPE (op));
+ prefill_name (r, op);
+ }
}
}
if (idx)
diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 9b6520fd2dd..2bc2c3db7d7 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -1837,7 +1837,7 @@ cprop_operand (gimple *stmt, use_operand_p op_p, range_query *query)
val = SSA_NAME_VALUE (op);
if (!val)
{
- int_range<2> r;
+ Value_Range r (TREE_TYPE (op));
tree single;
if (query->range_of_expr (r, op, stmt) && r.singleton_p (&single))
val = single;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-04 18:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 18:45 [gcc r13-1463] Misc conversions to vrange Aldy Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).