public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Dimitrije Milošević" <dimitrije.milosevic@syrmia.com>
To: gcc-patches@gcc.gnu.org
Cc: djordje.todorovic@syrmia.com, richard.guenther@gmail.com,
	jeffreyalaw@gmail.com,
	"Dimitrije Milošević" <dimitrije.milosevic@syrmia.com>
Subject: [PATCH 2/2] ivopts: Revert register pressure cost when there are enough registers.
Date: Wed, 21 Dec 2022 14:12:14 +0100	[thread overview]
Message-ID: <20221221131214.190579-3-dimitrije.milosevic@syrmia.com> (raw)
In-Reply-To: <20221221131214.190579-1-dimitrije.milosevic@syrmia.com>

When there are enough registers, the register pressure cost is
unnecessarily bumped by adding another n_cands.

This behavior may result in register pressure costs for the case
when there are enough registers being higher than for other cases.

When there are enough registers, the register pressure cost should be
equal to n_invs + n_cands.

This used to be the case before c18101f.

gcc/ChangeLog:

	* tree-ssa-loop-ivopts.cc (ivopts_estimate_reg_pressure): Adjust.

Signed-off-by: Dimitrije Milosevic <dimitrije.milosevic@syrmia.com>
---
 gcc/tree-ssa-loop-ivopts.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc
index 60c61dc9e49..3176482d0d9 100644
--- a/gcc/tree-ssa-loop-ivopts.cc
+++ b/gcc/tree-ssa-loop-ivopts.cc
@@ -6092,7 +6092,7 @@ ivopts_estimate_reg_pressure (struct ivopts_data *data, unsigned n_invs,
 
   /* If we have enough registers.  */
   if (regs_needed + target_res_regs < available_regs)
-    cost = n_new;
+    return n_new;
   /* If close to running out of registers, try to preserve them.  */
   else if (regs_needed <= available_regs)
     cost = target_reg_cost [speed] * regs_needed;
-- 
2.25.1


  parent reply	other threads:[~2022-12-21 13:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 13:12 [PATCH 0/2]: Fix address cost complexity and register pressure cost calculation Dimitrije Milošević
2022-12-21 13:12 ` [PATCH 1/2] ivopts: Compute complexity for unsupported addressing modes Dimitrije Milošević
2022-12-21 13:12 ` Dimitrije Milošević [this message]
2023-05-15 10:44   ` [PATCH 2/2] ivopts: Revert register pressure cost when there are enough registers Richard Biener
2023-05-15 12:23     ` Richard Biener
2023-05-15 14:32       ` Jovan Dmitrovic

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=20221221131214.190579-3-dimitrije.milosevic@syrmia.com \
    --to=dimitrije.milosevic@syrmia.com \
    --cc=djordje.todorovic@syrmia.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=richard.guenther@gmail.com \
    /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).