public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-2333] Make compute_operand_range a tail call.
Date: Wed,  5 Jul 2023 23:08:19 +0000 (GMT)	[thread overview]
Message-ID: <20230705230819.41D313856261@sourceware.org> (raw)

https://gcc.gnu.org/g:778099c426d7162000f1ed8d2937488e54021b75

commit r14-2333-g778099c426d7162000f1ed8d2937488e54021b75
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Wed Jul 5 14:26:00 2023 -0400

    Make compute_operand_range a tail call.
    
    Tweak the routine so it is making a tail call.
    
            * gimple-range-gori.cc (compute_operand_range): Convert to a tail
            call.

Diff:
---
 gcc/gimple-range-gori.cc | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index b036ed56f02..6dc15a0ce3f 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -725,36 +725,34 @@ gori_compute::compute_operand_range (vrange &r, gimple *stmt,
 			     op1_trange, op1_frange, op2_trange, op2_frange);
       if (idx)
 	tracer.trailer (idx, "compute_operand", res, name, r);
+      return res;
     }
   // Follow the appropriate operands now.
-  else if (op1_in_chain && op2_in_chain)
-    res = compute_operand1_and_operand2_range (r, handler, lhs, name, src,
-					       vrel_ptr);
-  else if (op1_in_chain)
+  if (op1_in_chain && op2_in_chain)
+    return compute_operand1_and_operand2_range (r, handler, lhs, name, src,
+						vrel_ptr);
+  Value_Range vr;
+  gimple *src_stmt;
+  if (op1_in_chain)
     {
-      Value_Range vr (TREE_TYPE (op1));
+      vr.set_type (TREE_TYPE (op1));
       if (!compute_operand1_range (vr, handler, lhs, src, vrel_ptr))
 	return false;
-      gimple *src_stmt = SSA_NAME_DEF_STMT (op1);
-      gcc_checking_assert (src_stmt);
-      // Then feed this range back as the LHS of the defining statement.
-      return compute_operand_range (r, src_stmt, vr, name, src, vrel_ptr);
+      src_stmt = SSA_NAME_DEF_STMT (op1);
     }
-  else if (op2_in_chain)
+  else
     {
-      Value_Range vr (TREE_TYPE (op2));
+      gcc_checking_assert (op2_in_chain);
+      vr.set_type (TREE_TYPE (op2));
       if (!compute_operand2_range (vr, handler, lhs, src, vrel_ptr))
 	return false;
-      gimple *src_stmt = SSA_NAME_DEF_STMT (op2);
-      gcc_checking_assert (src_stmt);
-      // Then feed this range back as the LHS of the defining statement.
-      return compute_operand_range (r, src_stmt, vr, name, src, vrel_ptr);
+      src_stmt = SSA_NAME_DEF_STMT (op2);
     }
-  else
-    gcc_unreachable ();
 
+  gcc_checking_assert (src_stmt);
+  // Then feed this range back as the LHS of the defining statement.
+  return compute_operand_range (r, src_stmt, vr, name, src, vrel_ptr);
   // If neither operand is derived, this statement tells us nothing.
-  return res;
 }

                 reply	other threads:[~2023-07-05 23:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230705230819.41D313856261@sourceware.org \
    --to=amacleod@gcc.gnu.org \
    --cc=gcc-cvs@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).