From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <rguenther@suse.de>,
Eric Botcazou <ebotcazou@adacore.com>,
Jeff Law <law@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] Improve seq_cost (PR middle-end/80929)
Date: Wed, 29 Nov 2017 08:19:00 -0000 [thread overview]
Message-ID: <20171129080942.GT2353@tucnak> (raw)
Hi!
This PR complains that seq_cost counts all non-single_set insns as 1
unconditionally, which is indeed bad. For some like compare + arithmetics
we even have now code in pattern_cost that handles those reasonably by
default, for others targets have the option through a hook to return
whatever they want.
On the other side, IMNSHO we don't want to count CODE_LABELs, NOTEs,
BARRIERs, DEBUG_INSNs...
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2017-11-29 Jakub Jelinek <jakub@redhat.com>
PR middle-end/80929
* rtlanal.c (seq_cost): For non-single_set insns try to use insn_cost.
--- gcc/rtlanal.c.jj 2017-10-27 14:16:39.000000000 +0200
+++ gcc/rtlanal.c 2017-11-27 13:35:46.321509933 +0100
@@ -5342,7 +5342,13 @@ seq_cost (const rtx_insn *seq, bool spee
if (set)
cost += set_rtx_cost (set, speed);
- else
- cost++;
+ else if (NONDEBUG_INSN_P (seq))
+ {
+ int this_cost = insn_cost (CONST_CAST_RTX_INSN (seq), speed);
+ if (this_cost > 0)
+ cost += this_cost;
+ else
+ cost++;
+ }
}
return cost;
Jakub
next reply other threads:[~2017-11-29 8:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 8:19 Jakub Jelinek [this message]
2017-11-29 9:46 ` Richard Biener
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=20171129080942.GT2353@tucnak \
--to=jakub@redhat.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=rguenther@suse.de \
/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).