This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/15345] [3.4 Regression] [non-unit-at-a-time] unreferenced nested inline functions not optimized away
- From: "jh at suse dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jul 2004 15:44:02 -0000
- Subject: [Bug middle-end/15345] [3.4 Regression] [non-unit-at-a-time] unreferenced nested inline functions not optimized away
- References: <20040509172606.15345.dank@kegel.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jh at suse dot cz 2004-07-19 15:43 -------
Subject: Re: [3.4 Regression] [non-unit-at-a-time] unreferenced nested inline functions not optimized away
>
> ------- Additional Comments From jakub at gcc dot gnu dot org 2004-07-19 14:11 -------
> This bug is IMHO very severe, it makes GCC 3.4.x totally unusable for glibc
> builds as it almost doubles the size of the dynamic linker.
> Can't this decision be reconsidered?
Why exactly does glibc rely on elliminating unused nested functions?
>
> It worked just fine until GCC 3.3.x because of the DECL_DEFER_OUTPUT setting
> in rest_of_compilation (now rest_of_handle_inlining).
>
> I have played with:
> --- gcc/toplev.c.jj 2004-02-20 19:37:45.000000000 +0100
> +++ gcc/toplev.c 2004-07-19 15:50:30.985366840 +0200
> @@ -2714,9 +2714,13 @@ rest_of_handle_inlining (tree decl)
> for unreferenced symbols. See g77.f-torture/execute/980520-1.f.
> But removing this line from the check breaks all languages that
> use the call graph to output symbols. This hard-coded check is
> - the least invasive work-around. */
> + the least invasive work-around.
> + C nested functions need to be deferred here too, otherwise
> + they will be emitted even when never used. */
> && (flag_inline_functions
> - || strcmp (lang_hooks.name, "GNU F77") == 0)
> + || strcmp (lang_hooks.name, "GNU F77") == 0
> + || (strcmp (lang_hooks.name, "GNU C") == 0
> + && DECL_CONTEXT (decl)))
> && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
> && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
> && ! flag_keep_inline_functions)
>
> Honza, can you see what problems could this cause?
That might work (using the old deffering code path just didn't occured
to me). Instead of relying on the hooks, I think we might simply use
cgraph_node (decl)->origin test so we won't mess up for methods (this is
why you need the checks for languages, right?)
Thanks!
Honza
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15345
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15345