public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org, rguenther@suse.de
Subject: Re: Order symbols before section copying in the lto streamer
Date: Thu, 24 Oct 2019 08:38:00 -0000	[thread overview]
Message-ID: <7de36f6c-faae-82c1-f403-8c12c3e1e0c2@suse.cz> (raw)
In-Reply-To: <20191023200239.p4v36ovkz27o7uyw@kam.mff.cuni.cz>

On 10/23/19 10:02 PM, Jan Hubicka wrote:
>> 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;
> +    }

Hi.

It's unclear to me why you need the patch. Isn't that equivalent?
Why you need only 1 and -1 return values?

Martin

>  
>    /* And finaly order by the definition order.  */
>    return n1->order - n2->order;
> 

  reply	other threads:[~2019-10-24  8:14 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
2019-10-24  8:38   ` Martin Liška [this message]
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=7de36f6c-faae-82c1-f403-8c12c3e1e0c2@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.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).