From: Jakub Jelinek <jakub@redhat.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Patch ping (Re: [PATCH] options, lto: Optimize streaming of optimization nodes)
Date: Mon, 5 Oct 2020 11:21:25 +0200 [thread overview]
Message-ID: <20201005092125.GN2176@tucnak> (raw)
In-Reply-To: <20200914094756.GV21814@tucnak>
On Mon, Sep 14, 2020 at 11:47:56AM +0200, Jakub Jelinek via Gcc-patches wrote:
> On Mon, Sep 14, 2020 at 11:02:26AM +0200, Jan Hubicka wrote:
> > Especially for the new param machinery, most of streamed values are
> > probably going to be the default values. Perhaps somehow we could
> > stream them more effectively.
>
> Ah, that seems like a good idea, that brings further savings, the size
> goes down from 574 bytes to 273 bytes, i.e. less than half.
> Here is an updated version that does that. Not trying to handle
> enums because the code doesn't know if (enum ...) 10 is even valid,
> similarly non-parameters because those really generally don't have large
> initializers, and params without Init (those are 0 initialized and thus
> don't need to be handled).
Here is an updated version of that on top of what has been committed.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2020-09-16 Jakub Jelinek <jakub@redhat.com>
* optc-save-gen.awk: Initialize var_opt_init. In
cl_optimization_stream_out for params with default values larger than
10, xor the default value with the actual parameter value. In
cl_optimization_stream_in repeat the above xor.
--- gcc/optc-save-gen.awk.jj 2020-09-14 10:51:54.493740942 +0200
+++ gcc/optc-save-gen.awk 2020-09-14 11:39:39.441602594 +0200
@@ -1186,6 +1186,7 @@ for (i = 0; i < n_opts; i++) {
var_opt_val_type[n_opt_val] = otype;
var_opt_val[n_opt_val] = "x_" name;
var_opt_hash[n_opt_val] = flag_set_p("Optimization", flags[i]);
+ var_opt_init[n_opt_val] = opt_args("Init", flags[i]);
n_opt_val++;
}
}
@@ -1257,10 +1258,21 @@ for (i = 0; i < n_opt_val; i++) {
otype = var_opt_val_type[i];
if (otype ~ "^const char \\**$")
print " bp_pack_string (ob, bp, ptr->" name", true);";
- else if (otype ~ "^unsigned")
- print " bp_pack_var_len_unsigned (bp, ptr->" name");";
- else
- print " bp_pack_var_len_int (bp, ptr->" name");";
+ else {
+ if (otype ~ "^unsigned") {
+ sgn = "unsigned";
+ } else {
+ sgn = "int";
+ }
+ if (name ~ "^x_param" && !(otype ~ "^enum ") && var_opt_init[i]) {
+ print " if (" var_opt_init[i] " > (" var_opt_val_type[i] ") 10)";
+ print " bp_pack_var_len_" sgn " (bp, ptr->" name" ^ " var_opt_init[i] ");";
+ print " else";
+ print " bp_pack_var_len_" sgn " (bp, ptr->" name");";
+ } else {
+ print " bp_pack_var_len_" sgn " (bp, ptr->" name");";
+ }
+ }
}
print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
print " bp_pack_value (bp, ptr->explicit_mask[i], 64);";
@@ -1281,10 +1293,18 @@ for (i = 0; i < n_opt_val; i++) {
print " if (ptr->" name")";
print " ptr->" name" = xstrdup (ptr->" name");";
}
- else if (otype ~ "^unsigned")
- print " ptr->" name" = (" var_opt_val_type[i] ") bp_unpack_var_len_unsigned (bp);";
- else
- print " ptr->" name" = (" var_opt_val_type[i] ") bp_unpack_var_len_int (bp);";
+ else {
+ if (otype ~ "^unsigned") {
+ sgn = "unsigned";
+ } else {
+ sgn = "int";
+ }
+ print " ptr->" name" = (" var_opt_val_type[i] ") bp_unpack_var_len_" sgn " (bp);";
+ if (name ~ "^x_param" && !(otype ~ "^enum ") && var_opt_init[i]) {
+ print " if (" var_opt_init[i] " > (" var_opt_val_type[i] ") 10)";
+ print " ptr->" name" ^= " var_opt_init[i] ";";
+ }
+ }
}
print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)";
print " ptr->explicit_mask[i] = bp_unpack_value (bp, 64);";
Jakub
next prev parent reply other threads:[~2020-10-05 9:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-13 8:33 [PATCH] options, lto: Optimize streaming of optimization nodes Jakub Jelinek
2020-09-14 6:39 ` Richard Biener
2020-09-14 7:00 ` Jakub Jelinek
2020-09-14 7:31 ` Richard Biener
2020-09-14 8:48 ` Jakub Jelinek
2020-09-14 9:02 ` Jan Hubicka
2020-09-14 9:47 ` Jakub Jelinek
2020-10-05 9:21 ` Jakub Jelinek [this message]
2020-11-18 9:36 ` Jakub Jelinek
2020-11-18 19:06 ` Joseph Myers
2022-03-31 13:22 ` options: Clarify 'Init' option property usage for streaming optimization (was: [PATCH] options, lto: Optimize streaming of optimization nodes) Thomas Schwinge
2022-10-26 13:46 ` [PING] " Thomas Schwinge
2022-10-26 18:21 ` Joseph Myers
2020-09-14 9:23 ` [PATCH] options, lto: Optimize streaming of optimization nodes 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=20201005092125.GN2176@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/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).