This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ICF versus inlining
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Martin LiÅka <mliska at suse dot cz>
- Date: Thu, 29 Jan 2015 05:17:59 -0800
- Subject: Re: ICF versus inlining
- Authentication-results: sourceware.org; auth=none
- References: <20150129070336 dot GA4982 at kam dot mff dot cuni dot cz>
On Wed, Jan 28, 2015 at 11:03 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> the PR is about function not being inlined because it is called via a wrapper
> introduced by ICF merging code. cgraph_node::create_wrapper set
> call_stmt_cannot_inline_p that I suggested to Martin to try to figure out how
> much of merging is undone by inliner. It was not meant to get into mainline.
>
> Because the wrappers may end up at performance critical places, I also added
> profile mainteinance - otherwise all BBs will get count of 0 and after
> inlining we end up with lousy code with -fprofile-use.
>
> To get sane inlining we probably want to make inliner to realize that call
> cost in thunk is minimal. I will look into that incrementally.
>
> Bootstrapped/regtested x86_64-linux, will commit shortly.
>
> PR ipa/64801
> * gcc.dg/tree-ssa/pr64801.c: New testcase.
> * cgraphunit.c (init_lowered_empty_function): Add CoUNT parameter;
> make sane BB profile.
> (cgraph_node::expand_thunk): Make sane BB profile.
> (cgraph_node::create_wrapper): Do not set call_stmt_cannot_inline_p.
> * cgraph.h (init_lowered_empty_function): Update prototype.
> * config/i386/i386.c (make_resolver_func): Update call.
> * predict.c (gate): Disable branch prediction pass if
> profile is already there.
>
> Index: testsuite/gcc.dg/tree-ssa/pr64801.c
> ===================================================================
> --- testsuite/gcc.dg/tree-ssa/pr64801.c (revision 0)
> +++ testsuite/gcc.dg/tree-ssa/pr64801.c (revision 0)
> @@ -0,0 +1,21 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fdump-tree-optimized" } */
> +int a;
> +int
> +elantech_detect (void)
> +{
> + return -38;
> +}
> +inline int
> +fsp_detect (void)
> +{
> + return -38;
> +}
> +void
> +psmouse_extensions (void)
> +{
> + int (*b)() = fsp_detect;
> + a = b ();
> +}
> +/* { dg-final { scan-tree-dump-not "fsp_detect"} } */
> +/* { dg-final { cleanup-tree-dump "optimized" } } */
I got
ERROR: gcc.dg/tree-ssa/pr64801.c: error executing dg-final:
scan-tree-dump-not: too few arguments
--
H.J.