public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
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] Refactor vrp_evaluate_conditional* and rename it.
Date: Wed, 26 Apr 2023 10:33:21 +0200	[thread overview]
Message-ID: <20230426083328.313566-2-aldyh@redhat.com> (raw)
In-Reply-To: <20230426083328.313566-1-aldyh@redhat.com>

gcc/ChangeLog:

	* vr-values.cc
	(simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops):
	Rename to...
	(simplify_using_ranges::legacy_fold_cond_overflow): ...this.
	(simplify_using_ranges::vrp_visit_cond_stmt): Rename to...
	(simplify_using_ranges::legacy_fold_cond): ...this.
	(simplify_using_ranges::fold_cond): Rename
	vrp_evaluate_conditional_warnv_with_ops to
	legacy_fold_cond_overflow.
	* vr-values.h (class vr_values): Replace vrp_visit_cond_stmt and
	vrp_evaluate_conditional_warnv_with_ops with legacy_fold_cond and
	legacy_fold_cond_overflow respectively.
---
 gcc/vr-values.cc | 25 +++++++++++--------------
 gcc/vr-values.h  |  5 ++---
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc
index 1d757eeffc3..e8643ea321e 100644
--- a/gcc/vr-values.cc
+++ b/gcc/vr-values.cc
@@ -638,20 +638,21 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops_using_ranges
   return res;
 }
 
-/* Helper function for vrp_evaluate_conditional_warnv. */
+/* Helper function for legacy_fold_cond.  */
 
 tree
-simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops
-						(gimple *stmt,
-						 enum tree_code code,
-						 tree op0, tree op1,
-						 bool *strict_overflow_p,
-						 bool *only_ranges)
+simplify_using_ranges::legacy_fold_cond_overflow (gimple *stmt,
+						  bool *strict_overflow_p,
+						  bool *only_ranges)
 {
   tree ret;
   if (only_ranges)
     *only_ranges = true;
 
+  tree_code code = gimple_cond_code (stmt);
+  tree op0 = gimple_cond_lhs (stmt);
+  tree op1 = gimple_cond_rhs (stmt);
+
   /* We only deal with integral and pointer types.  */
   if (!INTEGRAL_TYPE_P (TREE_TYPE (op0))
       && !POINTER_TYPE_P (TREE_TYPE (op0)))
@@ -736,7 +737,7 @@ simplify_using_ranges::vrp_evaluate_conditional_warnv_with_ops
    *TAKEN_EDGE_P.  Otherwise, set *TAKEN_EDGE_P to NULL.  */
 
 void
-simplify_using_ranges::vrp_visit_cond_stmt (gcond *stmt, edge *taken_edge_p)
+simplify_using_ranges::legacy_fold_cond (gcond *stmt, edge *taken_edge_p)
 {
   tree val;
 
@@ -765,11 +766,7 @@ simplify_using_ranges::vrp_visit_cond_stmt (gcond *stmt, edge *taken_edge_p)
     }
 
   bool sop;
-  val = vrp_evaluate_conditional_warnv_with_ops (stmt,
-						 gimple_cond_code (stmt),
-						 gimple_cond_lhs (stmt),
-						 gimple_cond_rhs (stmt),
-						 &sop, NULL);
+  val = legacy_fold_cond_overflow (stmt, &sop, NULL);
   if (val)
     *taken_edge_p = find_taken_edge (gimple_bb (stmt), val);
 
@@ -1471,7 +1468,7 @@ simplify_using_ranges::fold_cond (gcond *cond)
 
   // FIXME: Audit the code below and make sure it never finds anything.
   edge taken_edge;
-  vrp_visit_cond_stmt (cond, &taken_edge);
+  legacy_fold_cond (cond, &taken_edge);
 
   if (taken_edge)
     {
diff --git a/gcc/vr-values.h b/gcc/vr-values.h
index a89902c9c51..ff814155881 100644
--- a/gcc/vr-values.h
+++ b/gcc/vr-values.h
@@ -35,9 +35,8 @@ public:
   bool simplify (gimple_stmt_iterator *);
   bool fold_cond (gcond *);
 private:
-  void vrp_visit_cond_stmt (gcond *, edge *);
-  tree vrp_evaluate_conditional_warnv_with_ops (gimple *stmt, enum tree_code,
-						tree, tree, bool *, bool *);
+  void legacy_fold_cond (gcond *, edge *);
+  tree legacy_fold_cond_overflow (gimple *stmt, bool *, bool *);
   bool simplify_casted_cond (gcond *);
   bool simplify_truth_ops_using_ranges (gimple_stmt_iterator *, gimple *);
   bool simplify_div_or_mod_using_ranges (gimple_stmt_iterator *, gimple *);
-- 
2.40.0


  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 [COMMITTED] Remove compare_names* from legacy cond folding Aldy Hernandez
2023-04-26  8:33 ` Aldy Hernandez [this message]
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-2-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).