From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 2950F3857C62 for ; Mon, 5 Oct 2020 09:21:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2950F3857C62 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-594-s618QzYnN_GpaJD_D2ZjAA-1; Mon, 05 Oct 2020 05:21:43 -0400 X-MC-Unique: s618QzYnN_GpaJD_D2ZjAA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8A551018F61; Mon, 5 Oct 2020 09:21:41 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-37.ams2.redhat.com [10.36.112.37]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84A571002388; Mon, 5 Oct 2020 09:21:41 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 0959LXC8008500; Mon, 5 Oct 2020 11:21:38 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 0959LP30008498; Mon, 5 Oct 2020 11:21:25 +0200 Date: Mon, 5 Oct 2020 11:21:25 +0200 From: Jakub Jelinek To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org Subject: Patch ping (Re: [PATCH] options, lto: Optimize streaming of optimization nodes) Message-ID: <20201005092125.GN2176@tucnak> Reply-To: Jakub Jelinek References: <20200913083327.GG21814@tucnak> <20200914070048.GT21814@tucnak> <20200914084810.GU21814@tucnak> <20200914090226.GA27871@kam.mff.cuni.cz> <20200914094756.GV21814@tucnak> MIME-Version: 1.0 In-Reply-To: <20200914094756.GV21814@tucnak> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2020 09:21:46 -0000 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 * 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