From: Jan Hubicka <hubicka@ucw.cz>
To: Jeff Law <law@redhat.com>
Cc: mliska <mliska@suse.cz>, gcc-patches@gcc.gnu.org, hubicka@ucw.cz
Subject: Re: [PATCH 1/5] New Identical Code Folding IPA pass
Date: Wed, 18 Jun 2014 19:05:00 -0000 [thread overview]
Message-ID: <20140618185952.GA25408@atrey.karlin.mff.cuni.cz> (raw)
In-Reply-To: <53A09BDA.5020400@redhat.com>
> On 06/13/14 04:24, mliska wrote:
> >
> >You may ask, why the GNU GCC does need such a new optimization. The
> >compiler, having simply better knowledge of a compiled source file,
> >is capable of reaching better results, especially if Link-Time
> >optimization is enabled. Apart from that, GCC implementation adds
> >support for read-only variables like construction vtables (mentioned
> >in:
> >http://hubicka.blogspot.cz/2014/02/devirtualization-in-c-part-3-building.html).
> Can you outline at a high level cases where GCC's knowledge allows
> it to reach a better result? Is it because you're not requiring bit
> for bit identical code, but that the code merely be semantically
> equivalent?
>
> The GCC driven ICF seems to pick up 2X more opportunities than the
> gold driven ICF. But if I'm reading everything correctly, that
> includes ICF of both functions and variables.
There are important differences between in-GCC ICF and gold's ICF. Basically
- GCC ICF runs before most of context sensitive optimizations, so it does
see code that is identical to start with, but would become different
during optimization.
For example if you have function a1...a1000 calling function b1....b1000
where all bX are same, but all aX differs, then before inlining one
can easily unify b and let inliner's heuristic decide whether it is good
idea to duplicate body of b, while after inlining this is no longer
possible.
We don't do much in this respect, but we should try to unify accidental
code duplication early in early passes to not let duplicates bubble
until late optimizations where they may or may not be caught by
i.e. tail merging
This however also means that at least in current implementation it will
result in somewhat more corruption of debug info (by replacing inline
functions by different inline function with same body).
- GCC ICF (doesn't in the current implementation) can do value numbering
matching and match identical semantic with different implementation.
It is the plan to get smarter here, I just wanted to have something working
first and then play with more advanced tricks.
- GCC ICF sees some things as different while they are not in final assembly.
Types, alias classes and other details that are important for GCC but lost
in codegen. So here gold can do better work.
- Theoretically, if tuned well, GCC ICF could improve compilation speed
by avoiding need to optimize duplicates.
- Gold's ICF depends on functions sections that are not free.
- GCC ICF can be smarter about objects with address taken: we need analysis
deciding when the address can be compared with a different address.
This would be useful on other places, too.
Honza
>
> Do you have any sense of how those improvements break down? ie, is
> it mostly more function's you're finding as identical, and if so
> what is it about the GCC implementation that allows us to find more
> ICF opportunities. If it's mostly variables, that's fine too. I'm
> just trying to understand where the improvements are coming from.
>
> Jeff
next prev parent reply other threads:[~2014-06-18 19:05 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-16 10:07 mliska
2014-06-16 10:07 ` [PATCH 4/5] Existing tests fix mliska
2014-06-17 19:52 ` Jeff Law
2014-06-17 20:50 ` Rainer Orth
2014-06-18 9:02 ` Martin Liška
2014-06-30 12:12 ` Martin Liška
2014-09-26 12:21 ` Martin Liška
2014-06-16 10:07 ` [PATCH 5/5] New tests introduction mliska
2014-06-17 19:53 ` Jeff Law
2014-06-30 12:14 ` Martin Liška
2014-10-19 8:19 ` Andreas Schwab
2014-10-23 12:34 ` Martin Liška
2014-06-16 10:07 ` [PATCH 3/5] IPA ICF pass mliska
2014-06-20 7:32 ` Trevor Saunders
2014-06-26 11:18 ` Martin Liška
2014-07-05 21:44 ` Gerald Pfeifer
2014-07-05 22:53 ` Jan Hubicka
2014-07-17 15:23 ` Martin Liška
2014-09-26 12:20 ` Martin Liška
2014-09-26 14:44 ` Markus Trippelsdorf
2014-09-26 23:27 ` Jan Hubicka
2014-09-27 5:59 ` Markus Trippelsdorf
2014-09-27 7:47 ` Markus Trippelsdorf
2014-09-27 10:46 ` Martin Liška
2014-09-27 10:37 ` Martin Liška
2014-09-28 2:21 ` Jan Hubicka
2014-10-10 23:54 ` Fakturace
2014-10-11 0:02 ` Martin Liška
2014-10-11 8:23 ` Jan Hubicka
2014-10-13 13:20 ` Martin Liška
2014-10-13 13:29 ` Jan Hubicka
2014-09-27 10:32 ` Martin Liška
2014-09-26 20:47 ` Jan Hubicka
2014-10-11 0:08 ` Martin Liška
2014-10-11 8:26 ` Jan Hubicka
2014-10-13 15:17 ` Martin Liška
2014-10-14 16:12 ` Jan Hubicka
2014-10-15 17:06 ` Martin Liška
2014-10-22 21:20 ` Jiong Wang
2014-11-06 3:01 ` Joey Ye
2014-11-06 9:03 ` Jan Hubicka
2014-11-13 22:26 ` H.J. Lu
2015-01-20 21:29 ` H.J. Lu
2014-09-26 22:27 ` Jan Hubicka
2014-10-11 0:23 ` Martin Liška
2014-10-11 9:05 ` Jan Hubicka
2014-06-24 20:31 ` Jeff Law
2014-06-26 16:02 ` Martin Liška
2014-06-26 18:46 ` Jan Hubicka
2014-06-30 12:05 ` Martin Liška
2014-07-01 23:45 ` Trevor Saunders
2014-06-30 19:06 ` Jeff Law
2014-06-16 10:07 ` [PATCH 2/5] Existing call graph infrastructure enhancement mliska
2014-06-17 20:00 ` Jeff Law
2014-06-30 11:49 ` Martin Liška
2014-06-30 18:54 ` Jeff Law
2014-07-17 14:54 ` Martin Liška
2014-08-25 9:56 ` Martin Liška
2014-08-25 16:12 ` Jan Hubicka
2014-08-27 21:12 ` Jeff Law
2014-09-24 14:23 ` Martin Liška
2014-09-24 15:01 ` Jan Hubicka
2014-09-26 10:19 ` Martin Liška
2014-06-17 19:49 ` [PATCH 1/5] New Identical Code Folding IPA pass Jeff Law
2014-06-18 19:05 ` Jan Hubicka [this message]
2014-06-17 20:09 ` Paolo Carlini
2014-06-18 8:46 ` Martin Liška
2014-06-18 8:49 ` Paolo Carlini
2014-06-17 20:17 ` David Malcolm
2014-06-18 8:10 ` Martin Liška
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=20140618185952.GA25408@atrey.karlin.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
--cc=mliska@suse.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).