This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, PR 54394] Compute loops when generating inline summaries
- From: Martin Jambor <mjambor at suse dot cz>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Guenther <rguenther at suse dot de>
- Date: Fri, 31 Aug 2012 11:56:16 +0200
- Subject: Re: [PATCH, PR 54394] Compute loops when generating inline summaries
- References: <20120829182400.GC3395@virgil.arch.suse.de> <20120831085332.GD7104@kam.mff.cuni.cz>
On Fri, Aug 31, 2012 at 10:53:32AM +0200, Jan Hubicka wrote:
> > Hi,
> >
> > the patch below fixes PR 54394. The problem is that since revision
> > 190346 we depend on bb->loop_father being non-NULL to get loop_depth.
> > However, with loops not computed, the loop_father is NULL, loop_depth
> > is thus considered zero and call graph edges out of such BB can be
> > considered much cooler, leading to inlining regressions.
> >
> > This patch fixes that by recomputing loops whenever optimizing, not
> > only for loop bounds hints. We might put the computation elsewhere or
> > do it only under more restrictive circumstances, but I believe that
> > after rev. 190346 we have to do it. In particular, I am not sure
> > whether we had (semi)correct loop_depths when doing early inlining or
> > not, this patch re-calculates it for early inliner too.
> >
> > Bootstrapped and tested on x86_64-linux, fixes fatigue run-time on
> > an x86_64-linux and i686-linux for me. What do you think?
> >
> > Thanks,
> >
> > Martin
> >
> >
> > 2012-08-29 Martin Jambor <mjambor@suse.cz>
> >
> > PR middle-end/54394
> > * ipa-inline-analysis.c (estimate_function_body_sizes): Compute
> > dominance info and loops whenever optimizing.
> >
> >
> > Index: src/gcc/ipa-inline-analysis.c
> > ===================================================================
> > --- src.orig/gcc/ipa-inline-analysis.c
> > +++ src/gcc/ipa-inline-analysis.c
> > @@ -2102,6 +2102,11 @@ estimate_function_body_sizes (struct cgr
> > info->conds = 0;
> > info->entry = 0;
> >
> > + if (optimize)
>
> This is OK. I think you can also skip thi computation for early inlining
> where we don't do any hints, so probably if (optimize && !early)
>
> Honza
This is not required to make hints working, it is necessary because of
the following line a in estimate_function_body_sizes:
es->loop_depth = bb_loop_depth (bb);
which always yields zero if we don't have loops computed. So I can
skip the computation only if we don't care about loop depths in early
inlining either. Should I skip it?
Thanks,
Martin