From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: [COMMITTED] Remove compare_names* from legacy cond folding.
Date: Wed, 26 Apr 2023 10:33:20 +0200 [thread overview]
Message-ID: <20230426083328.313566-1-aldyh@redhat.com> (raw)
In a test run I have asserted that the legacy conditional folding only
gets overflows, so this removal is safe.
gcc/ChangeLog:
* vr-values.cc (get_vr_for_comparison): Remove.
(compare_name_with_value): Same.
(vrp_evaluate_conditional_warnv_with_ops): Remove calls to
compare_name_with_value.
* vr-values.h: Remove compare_name_with_value.
Remove get_vr_for_comparison.
---
gcc/vr-values.cc | 57 ------------------------------------------------
gcc/vr-values.h | 2 --
2 files changed, 59 deletions(-)
diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc
index 365f4976a39..1d757eeffc3 100644
--- a/gcc/vr-values.cc
+++ b/gcc/vr-values.cc
@@ -615,58 +615,6 @@ bounds_of_var_in_loop (tree *min, tree *max, range_query *query,
return true;
}
-/* Helper that gets the value range of the SSA_NAME with version I
- or a symbolic range containing the SSA_NAME only if the value range
- is varying or undefined. Uses TEM as storage for the alternate range. */
-
-const value_range *
-simplify_using_ranges::get_vr_for_comparison (int i, value_range *tem,
- gimple *s)
-{
- /* Shallow-copy equiv bitmap. */
- const value_range *vr = query->get_value_range (ssa_name (i), s);
-
- /* If name N_i does not have a valid range, use N_i as its own
- range. This allows us to compare against names that may
- have N_i in their ranges. */
- if (vr->varying_p () || vr->undefined_p ())
- {
- tree ssa = ssa_name (i);
- tem->set (ssa, ssa);
- return tem;
- }
-
- return vr;
-}
-
-/* Compare all the value ranges for names equivalent to VAR with VAL
- using comparison code COMP. Return the same value returned by
- compare_range_with_value, including the setting of
- *STRICT_OVERFLOW_P. */
-
-tree
-simplify_using_ranges::compare_name_with_value
- (enum tree_code comp, tree var, tree val,
- bool *strict_overflow_p, gimple *s)
-{
- /* Start at -1. Set it to 0 if we do a comparison without relying
- on overflow, or 1 if all comparisons rely on overflow. */
- int used_strict_overflow = -1;
-
- /* Compare vars' value range with val. */
- value_range tem_vr;
- const value_range *equiv_vr
- = get_vr_for_comparison (SSA_NAME_VERSION (var), &tem_vr, s);
- bool sop = false;
- tree retval = compare_range_with_value (comp, equiv_vr, val, &sop);
- if (retval)
- used_strict_overflow = sop ? 1 : 0;
-
- if (retval && used_strict_overflow > 0)
- *strict_overflow_p = true;
- return retval;
-}
-
/* Helper function for vrp_evaluate_conditional_warnv & other
optimizers. */
@@ -780,11 +728,6 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops
return ret;
if (only_ranges)
*only_ranges = false;
- if (TREE_CODE (op0) == SSA_NAME)
- return compare_name_with_value (code, op0, op1, strict_overflow_p, stmt);
- else if (TREE_CODE (op1) == SSA_NAME)
- return compare_name_with_value (swap_tree_comparison (code), op1, op0,
- strict_overflow_p, stmt);
return NULL_TREE;
}
diff --git a/gcc/vr-values.h b/gcc/vr-values.h
index 00fcf7702aa..a89902c9c51 100644
--- a/gcc/vr-values.h
+++ b/gcc/vr-values.h
@@ -52,8 +52,6 @@ private:
bool two_valued_val_range_p (tree, tree *, tree *, gimple *);
bool op_with_boolean_value_range_p (tree, gimple *);
- tree compare_name_with_value (enum tree_code, tree, tree, bool *, gimple *);
- const value_range *get_vr_for_comparison (int, value_range *, gimple *s);
tree vrp_evaluate_conditional_warnv_with_ops_using_ranges (enum tree_code,
tree, tree,
bool *, gimple *s);
--
2.40.0
next reply other threads:[~2023-04-26 8:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 8:33 Aldy Hernandez [this message]
2023-04-26 8:33 ` [COMMITTED] Refactor vrp_evaluate_conditional* and rename it Aldy Hernandez
2023-04-26 8:33 ` [COMMITTED] Remove range_query::get_value_range Aldy Hernandez
2023-04-26 8:33 ` [COMMITTED] Remove deprecated range_fold_{unary,binary}_expr uses from ipa-* Aldy Hernandez
2023-05-05 15:10 ` [COMMITTED] Remove deprecated range_fold_{unary, binary}_expr " Martin Jambor
2023-05-11 9:58 ` Aldy Hernandez
2023-05-15 17:33 ` Aldy Hernandez
2023-04-26 8:33 ` [COMMITTED] Remove range_fold_{unary,binary}_expr Aldy Hernandez
2023-04-26 8:33 ` [COMMITTED] Remove irange::may_contain_p Aldy Hernandez
2023-04-26 8:33 ` [COMMITTED] Remove symbolics from irange Aldy Hernandez
2023-04-26 8:33 ` [COMMITTED] Remove irange::constant_p Aldy Hernandez
2023-04-26 8:33 ` [COMMITTED] Convert users of legacy API to get_legacy_range() function Aldy Hernandez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230426083328.313566-1-aldyh@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).