From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org, rguenther@suse.de, mliska@suse.cz
Subject: Re: Order symbols before section copying in the lto streamer
Date: Wed, 23 Oct 2019 20:35:00 -0000 [thread overview]
Message-ID: <20191023200239.p4v36ovkz27o7uyw@kam.mff.cuni.cz> (raw)
In-Reply-To: <20191017071033.wg2aes6gvlkr5d45@kam.mff.cuni.cz>
> Hi,
> this patch orders symbols where we copy sections to match the order
> of files in the command line. This optimizes streaming process since we
> are not opening and closing files randomly and also we read them more
> sequentially. This saves some kernel time though I think more can be
> done if we avoid doing pair of mmap/unmap for every file section we
> read.
>
> We also read files in random order in ipa-cp and during devirt.
> I guess also summary streaming can be refactored to stream all summaries
> for a given file instead of reading one sumarry from all files.
>
> Bootstrapped/regtested x86_64-linux, plan to commit it this afternoon if
> there are no complains.
>
> Honza
>
> * lto-common.c (lto_file_finalize): Add order attribute.
> (lto_create_files_from_ids): Pass order.
> (lto_file_read): UPdate call of lto_create_files_from_ids.
> * lto-streamer-out.c (output_constructor): Push CTORS_OUT timevar.
> (cmp_symbol_files): New.
> (lto_output): Copy sections in file order.
> * lto-streamer.h (lto_file_decl_data): Add field order.
Hi,
I have commited the patch but messed up testing so it broke builds with
static libraries and checking enabled. This is fixes by this patch
* lto-streamer-out.c (cmp_symbol_files): Watch for overflow.
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c (revision 277346)
+++ lto-streamer-out.c (working copy)
@@ -2447,7 +2447,12 @@ cmp_symbol_files (const void *pn1, const
/* Order within static library. */
if (n1->lto_file_data && n1->lto_file_data->id != n2->lto_file_data->id)
- return n1->lto_file_data->id - n2->lto_file_data->id;
+ {
+ if (n1->lto_file_data->id > n2->lto_file_data->id)
+ return 1;
+ if (n1->lto_file_data->id < n2->lto_file_data->id)
+ return -1;
+ }
/* And finaly order by the definition order. */
return n1->order - n2->order;
next prev parent reply other threads:[~2019-10-23 20:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 7:15 Jan Hubicka
2019-10-23 20:35 ` Jan Hubicka [this message]
2019-10-24 8:38 ` Martin Liška
2019-10-24 9:58 ` Jan Hubicka
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=20191023200239.p4v36ovkz27o7uyw@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
--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).