This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC's ICF vs. gold's ICF
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Frank Tetzel <s1445051 at mail dot zih dot tu-dresden dot de>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 15 Jan 2019 14:29:04 +0100
- Subject: Re: GCC's ICF vs. gold's ICF
- References: <20190115141110.5bc23421@archvm>
On Tue, Jan 15, 2019 at 2:18 PM Frank Tetzel
<s1445051@mail.zih.tu-dresden.de> wrote:
>
> Hi,
>
> why is the ICF pass in gcc not folding member functions which depend on
> a template parameter but happen to generate identical code?
> Is it because it is not identical on the IR level in the compiler?
> Can I somehow dump the IR in text form?
You can look at the ICF dump generated when you pass -fdump-ipa-icf-details
And yes, ICF has to consider IL differences that may result in different
allowed followup optimizations while when the IL is final (such as link-time)
no such considerations have to be made. A very simple example would
be signed vs. unsigned integer multiplication where from the former IL
overflow would be undefined and optimizations can exploit that while not
for the latter.
> The ICF pass in the gold linker can do it on binary level which is kind
> of mentioned in manpage of gcc. I'm just interested in why the compiler
> cannot do it on its own.
>
> There is a test program in a blog post I wrote [1].
>
> Best regards,
> Frank
>
> [1] https://tetzank.github.io/posts/identical-code-folding/#consolidating-independent-member-functions