This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Reduce number of sreal operator* calls
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 Nov 2018 13:24:44 +0100
- Subject: Re: [PATCH] Reduce number of sreal operator* calls
- References: <alpine.LSU.2.20.1811071244260.1827@zhemvz.fhfr.qr>
>
> This reduces the number of $subject calls by computing big_speedup_p
> lazily. This caller accounts for roughly a quarter of all operator*
> calls for PR38474 and operator* is top of the profile of the whole
> compilation.
>
> Next offenders (callers) are compute_inlined_call_time and
> edge_badness. profile_count::to_sreal_scale is also quite
> bad in performance btw (probably due to the sreal division).
>
> Bootstrap/regtest in progress.
>
> OK?
OK, thanks!
Honza
>
> Thanks,
> Richard.
>
> 2018-11-07 Richard Biener <rguenther@suse.de>
>
> * ipa-inline.c (want_inline_small_function_p): Compute
> big_speedup_p lazily and last.
>
> Index: gcc/ipa-inline.c
> ===================================================================
> --- gcc/ipa-inline.c (revision 265860)
> +++ gcc/ipa-inline.c (working copy)
> @@ -779,7 +779,7 @@ want_inline_small_function_p (struct cgr
> {
> int growth = estimate_edge_growth (e);
> ipa_hints hints = estimate_edge_hints (e);
> - bool big_speedup = big_speedup_p (e);
> + int big_speedup = -1; /* compute this lazily */
>
> if (growth <= 0)
> ;
> @@ -787,13 +787,13 @@ want_inline_small_function_p (struct cgr
> hints suggests that inlining given function is very profitable. */
> else if (DECL_DECLARED_INLINE_P (callee->decl)
> && growth >= MAX_INLINE_INSNS_SINGLE
> - && ((!big_speedup
> - && !(hints & (INLINE_HINT_indirect_call
> + && (growth >= MAX_INLINE_INSNS_SINGLE * 16
> + || (!(hints & (INLINE_HINT_indirect_call
> | INLINE_HINT_known_hot
> | INLINE_HINT_loop_iterations
> | INLINE_HINT_array_index
> - | INLINE_HINT_loop_stride)))
> - || growth >= MAX_INLINE_INSNS_SINGLE * 16))
> + | INLINE_HINT_loop_stride))
> + && !(big_speedup = big_speedup_p (e)))))
> {
> e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT;
> want_inline = false;
> @@ -813,7 +813,6 @@ want_inline_small_function_p (struct cgr
> Upgrade it to MAX_INLINE_INSNS_SINGLE when hints suggests that
> inlining given function is very profitable. */
> else if (!DECL_DECLARED_INLINE_P (callee->decl)
> - && !big_speedup
> && !(hints & INLINE_HINT_known_hot)
> && growth >= ((hints & (INLINE_HINT_indirect_call
> | INLINE_HINT_loop_iterations
> @@ -821,7 +820,8 @@ want_inline_small_function_p (struct cgr
> | INLINE_HINT_loop_stride))
> ? MAX (MAX_INLINE_INSNS_AUTO,
> MAX_INLINE_INSNS_SINGLE)
> - : MAX_INLINE_INSNS_AUTO))
> + : MAX_INLINE_INSNS_AUTO)
> + && !(big_speedup == -1 ? big_speedup_p (e) : big_speedup))
> {
> /* growth_likely_positive is expensive, always test it last. */
> if (growth >= MAX_INLINE_INSNS_SINGLE