Re: [google] Dump inline decisions more wisely
Here is the new patch. Thanks, Dehao Index: gcc/ipa-inline.c === --- gcc/ipa-inline.c(revision 182864) +++ gcc/ipa-inline.c(working copy) @@ -308,12 +308,12 @@ bfd_name = "unknown"; buf_size = strlen (bfd_name) + 1; - if (flag_opt_info >= OPT_INFO_MED && profile_info) + if (profile_info) buf_size += (2 * MAX_INT_LENGTH + 5); buf = (char *) xmalloc (buf_size); strcpy (buf, bfd_name); - if (flag_opt_info >= OPT_INFO_MED && profile_info) + if (profile_info) sprintf (buf, "%s ("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")", buf, node->count, node->max_bb_count); @@ -354,6 +354,9 @@ return buf; } +/* File static variable to denote if it is in ipa-inline pass. */ +static bool is_in_ipa_inline = false; + /* Dump the inline decision of EDGE to stderr. */ static void @@ -364,6 +367,8 @@ const char *call_count_text; struct cgraph_node *final_caller = edge->caller; + if (flag_opt_info < OPT_INFO_MED && !is_in_ipa_inline) +return; if (final_caller->global.inlined_to != NULL) inline_chain_text = cgraph_node_call_chain (final_caller, &final_caller); else @@ -1193,6 +1198,8 @@ int min_size, max_size; VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL; + is_in_ipa_inline = true; + if (flag_indirect_inlining) new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8); On Fri, Jan 6, 2012 at 1:39 PM, Xinliang David Li wrote: > Not ideal but better. Ok with this change. > > David > > On Thu, Jan 5, 2012 at 5:47 PM, Dehao Chen wrote: >> Or use a new global variable to denote whether it's in early-inline or >> ipa-inline? >> >> Dehao >> >> On Fri, Jan 6, 2012 at 1:46 AM, Xinliang David Li wrote: >>> >>> Is there a better way to detect early inline phase and ipa_inline >>> pass? Use always_inline_functions_inlined flag seems hacky. >>> >>> David >>> >>> On Wed, Jan 4, 2012 at 1:12 AM, Dehao Chen wrote: >>> > Hi, >>> > >>> > This patch: >>> > >>> > * dump inline decisions with profile info whenever available. >>> > * disable dump of einline decisions at OPT_INFO_MIN. >>> > >>> > Is it ok for google branches? >>> > >>> > thanks, >>> > Dehao >>> > >>> > 2012-01-04 Dehao Chen >>> > >>> > * ipa-inline.c (cgraph_node_opt_info): Print profile info if >>> > available >>> > (dump_inline_decision): Disable einline dump at OPT_INFO_MIN >>> > >>> > Index: gcc/ipa-inline.c >>> > === >>> > --- gcc/ipa-inline.c (revision 182864) >>> > +++ gcc/ipa-inline.c (working copy) >>> > @@ -308,12 +308,12 @@ >>> > bfd_name = "unknown"; >>> > >>> > buf_size = strlen (bfd_name) + 1; >>> > - if (flag_opt_info >= OPT_INFO_MED && profile_info) >>> > + if (profile_info) >>> > buf_size += (2 * MAX_INT_LENGTH + 5); >>> > buf = (char *) xmalloc (buf_size); >>> > >>> > strcpy (buf, bfd_name); >>> > - if (flag_opt_info >= OPT_INFO_MED && profile_info) >>> > + if (profile_info) >>> > sprintf (buf, >>> > "%s ("HOST_WIDEST_INT_PRINT_DEC", >>> > "HOST_WIDEST_INT_PRINT_DEC")", >>> > buf, node->count, node->max_bb_count); >>> > @@ -364,6 +364,16 @@ >>> > const char *call_count_text; >>> > struct cgraph_node *final_caller = edge->caller; >>> > >>> > + if (flag_opt_info < OPT_INFO_MED) >>> > + { >>> > + tree decl = edge->caller->decl; >>> > + if (decl) >>> > + { >>> > + struct function *fn = DECL_STRUCT_FUNCTION (decl); >>> > + if (!fn || !fn->always_inline_functions_inlined) >>> > + return; >>> > + } >>> > + } >>> > if (final_caller->global.inlined_to != NULL) >>> > inline_chain_text = cgraph_node_call_chain (final_caller, >>> > &final_caller); >>> > else
Re: [C++ Patch] deprecation of access declarations
On Thu, 29 Dec 2011, Fabien Chêne wrote: > As previously announced, here is a patch that deprecate access > declarations . I did a little tour in the GCC museum old-deja --and in > g++.dg as well -- to disinter and adjust those dusty tests. To avoid > false positive on invalid code, I have decided to only emit the > warning if the access declaration is actually valid. Mind suggesting a snippt for our release notes at http://gcc.gnu.org/gcc-4.7/changes.html ? (http://gcc.gnu.org/cvs.html has background on how to make changes to our web pages, though if you want to send just a patch against the online ones or a text snippet, I'll take care of the rest.) Gerald
Re: [PATCH] [MIPS] Add Octeon2 cpu support to GCC
On Wed, 4 Jan 2012, Andrew Pinski wrote: > Woops, I had missed that. Here is the patch which adds both octeon+ > and octeon2 to that list. > > I committed as obvious after a build. You may want to update the release notes as well (htdocs/gcc-4.7/changes.html). Gerald
[committed] Skip gcc.misc-tests/gcov-13.c and gcov-14.c on 32-bit hppa*-*-hpux*
Tests need to be skipped for reasons noted in PRs. Tested on hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11. Committed to trunk. Dave -- J. David Anglin dave.ang...@nrc-cnrc.gc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6602) 2012-01-07 John David Anglin PR gcov-profile/51715 PR gcov-profile/51717 * gcc.misc-tests/gcov-13.c: Skip on 32-bit hppa*-*-hpux*. * gcc.misc-tests/gcov-14.c: Likewise. Index: gcc.misc-tests/gcov-13.c === --- gcc.misc-tests/gcov-13.c(revision 182980) +++ gcc.misc-tests/gcov-13.c(working copy) @@ -4,6 +4,7 @@ /* { dg-require-weak "" } */ /* { dg-do run { target native } } */ /* { dg-additional-sources "gcovpart-13b.c" } */ +/* { dg-skip-if "weak ellision not supported" { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */ int __attribute__ ((weak)) weak () { Index: gcc.misc-tests/gcov-14.c === --- gcc.misc-tests/gcov-14.c(revision 182980) +++ gcc.misc-tests/gcov-14.c(working copy) @@ -5,6 +5,7 @@ /* { dg-additional-options "-flat_namespace -undefined suppress" { target *-*-darwin* } } */ /* { dg-require-weak "" } */ /* { dg-do run { target native } } */ +/* { dg-skip-if "undefined weak not supported" { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */ extern int __attribute__ ((weak)) Foo ();
Re: [google] Dump inline decisions more wisely
ok for google branches. David On Sat, Jan 7, 2012 at 1:46 AM, Dehao Chen wrote: > Here is the new patch. > > Thanks, > Dehao > > Index: gcc/ipa-inline.c > === > --- gcc/ipa-inline.c (revision 182864) > +++ gcc/ipa-inline.c (working copy) > @@ -308,12 +308,12 @@ > bfd_name = "unknown"; > > buf_size = strlen (bfd_name) + 1; > - if (flag_opt_info >= OPT_INFO_MED && profile_info) > + if (profile_info) > buf_size += (2 * MAX_INT_LENGTH + 5); > buf = (char *) xmalloc (buf_size); > > strcpy (buf, bfd_name); > - if (flag_opt_info >= OPT_INFO_MED && profile_info) > + if (profile_info) > sprintf (buf, > "%s ("HOST_WIDEST_INT_PRINT_DEC", "HOST_WIDEST_INT_PRINT_DEC")", > buf, node->count, node->max_bb_count); > @@ -354,6 +354,9 @@ > return buf; > } > > +/* File static variable to denote if it is in ipa-inline pass. */ > +static bool is_in_ipa_inline = false; > + > /* Dump the inline decision of EDGE to stderr. */ > > static void > @@ -364,6 +367,8 @@ > const char *call_count_text; > struct cgraph_node *final_caller = edge->caller; > > + if (flag_opt_info < OPT_INFO_MED && !is_in_ipa_inline) > + return; > if (final_caller->global.inlined_to != NULL) > inline_chain_text = cgraph_node_call_chain (final_caller, &final_caller); > else > @@ -1193,6 +1198,8 @@ > int min_size, max_size; > VEC (cgraph_edge_p, heap) *new_indirect_edges = NULL; > > + is_in_ipa_inline = true; > + > if (flag_indirect_inlining) > new_indirect_edges = VEC_alloc (cgraph_edge_p, heap, 8); > > On Fri, Jan 6, 2012 at 1:39 PM, Xinliang David Li wrote: >> Not ideal but better. Ok with this change. >> >> David >> >> On Thu, Jan 5, 2012 at 5:47 PM, Dehao Chen wrote: >>> Or use a new global variable to denote whether it's in early-inline or >>> ipa-inline? >>> >>> Dehao >>> >>> On Fri, Jan 6, 2012 at 1:46 AM, Xinliang David Li >>> wrote: Is there a better way to detect early inline phase and ipa_inline pass? Use always_inline_functions_inlined flag seems hacky. David On Wed, Jan 4, 2012 at 1:12 AM, Dehao Chen wrote: > Hi, > > This patch: > > * dump inline decisions with profile info whenever available. > * disable dump of einline decisions at OPT_INFO_MIN. > > Is it ok for google branches? > > thanks, > Dehao > > 2012-01-04 Dehao Chen > > * ipa-inline.c (cgraph_node_opt_info): Print profile info if > available > (dump_inline_decision): Disable einline dump at OPT_INFO_MIN > > Index: gcc/ipa-inline.c > === > --- gcc/ipa-inline.c (revision 182864) > +++ gcc/ipa-inline.c (working copy) > @@ -308,12 +308,12 @@ > bfd_name = "unknown"; > > buf_size = strlen (bfd_name) + 1; > - if (flag_opt_info >= OPT_INFO_MED && profile_info) > + if (profile_info) > buf_size += (2 * MAX_INT_LENGTH + 5); > buf = (char *) xmalloc (buf_size); > > strcpy (buf, bfd_name); > - if (flag_opt_info >= OPT_INFO_MED && profile_info) > + if (profile_info) > sprintf (buf, > "%s ("HOST_WIDEST_INT_PRINT_DEC", > "HOST_WIDEST_INT_PRINT_DEC")", > buf, node->count, node->max_bb_count); > @@ -364,6 +364,16 @@ > const char *call_count_text; > struct cgraph_node *final_caller = edge->caller; > > + if (flag_opt_info < OPT_INFO_MED) > + { > + tree decl = edge->caller->decl; > + if (decl) > + { > + struct function *fn = DECL_STRUCT_FUNCTION (decl); > + if (!fn || !fn->always_inline_functions_inlined) > + return; > + } > + } > if (final_caller->global.inlined_to != NULL) > inline_chain_text = cgraph_node_call_chain (final_caller, > &final_caller); > else
PR tree-optimization/51680 (not inlining comdats)
Hi, this patch fixes first half of the PR. The PR is about a function that is supposed to be inlined at -O2. The function contains two calls, one indirect and inlining the indirect call makes things a lot better. GCC however things that replacing call by two calls at -O2 is a bad idea. This patch solves first part of it. The function in question is COMDAT. We already know that C++ coding style makes COMDATs quite rarely to be shared and at -Os we already handle them sort of similarly to static ufnctions. We however don't do that at -O2. This patch makes it happen in both cases. Bootstrapped/regtested x86_64-linux, comitted. Will commit the testcase with the followup fix. PR tree-optimization/51680 * ipa-inline.c (want_inline_small_function_p): Be more lax on functions whose inlining reduce unit size. Index: ipa-inline.c === --- ipa-inline.c(revision 182949) +++ ipa-inline.c(working copy) @@ -482,21 +482,13 @@ want_inline_small_function_p (struct cgr e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT; want_inline = false; } - else if (!DECL_DECLARED_INLINE_P (callee->decl) - && !flag_inline_functions) - { - e->inline_failed = CIF_NOT_DECLARED_INLINED; - want_inline = false; - } - else if (!DECL_DECLARED_INLINE_P (callee->decl) - && growth >= MAX_INLINE_INSNS_AUTO) - { - e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT; - want_inline = false; - } - /* If call is cold, do not inline when function body would grow. -Still inline when the overall unit size will shrink because the offline -copy of function being eliminated. + /* Before giving up based on fact that caller size will grow, allow + functions that are called few times and eliminating the offline +copy will lead to overall code size reduction. +Not all of these will be handled by subsequent inlining of functions +called once: in particular weak functions are not handled or funcitons +that inline to multiple calls but a lot of bodies is optimized out. +Finally we want to inline earlier to allow inlining of callbacks. This is slightly wrong on aggressive side: it is entirely possible that function is called many times with a context where inlining @@ -509,24 +501,39 @@ want_inline_small_function_p (struct cgr first, this situation is not a problem at all: after inlining all "good" calls, we will realize that keeping the function around is better. */ - else if (!cgraph_maybe_hot_edge_p (e) - && (DECL_EXTERNAL (callee->decl) + else if (growth <= MAX_INLINE_INSNS_SINGLE + /* Unlike for functions called once, we play unsafe with + COMDATs. We can allow that since we know functions + in consideration are small (and thus risk is small) and + moreover grow estimates already accounts that COMDAT + functions may or may not disappear when eliminated from + current unit. With good probability making aggressive + choice in all units is going to make overall program + smaller. + + Consequently we ask cgraph_can_remove_if_no_direct_calls_p + instead of + cgraph_will_be_removed_from_program_if_no_direct_calls */ + && !DECL_EXTERNAL (callee->decl) + && cgraph_can_remove_if_no_direct_calls_p (callee) + && estimate_growth (callee) <= 0) + ; + else if (!DECL_DECLARED_INLINE_P (callee->decl) + && !flag_inline_functions) + { + e->inline_failed = CIF_NOT_DECLARED_INLINED; + want_inline = false; + } + else if (!DECL_DECLARED_INLINE_P (callee->decl) + && growth >= MAX_INLINE_INSNS_AUTO) + { + e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT; + want_inline = false; + } + /* If call is cold, do not inline when function body would grow. */ + else if (!cgraph_maybe_hot_edge_p (e)) - /* Unlike for functions called once, we play unsafe with - COMDATs. We can allow that since we know functions - in consideration are small (and thus risk is small) and - moreover grow estimates already accounts that COMDAT - functions may or may not disappear when eliminated from - current unit. With good probability making aggressive - choice in all units is going to make overall program - smaller. - - Consequently we ask cgraph_can_remove_if_no_direct_calls_p - instead of - cgrap
Re: increase call_saved_regs[] in caller-save.c
On Mon, 2011-11-07 at 09:27 +0100, Michael Matz wrote: > One source of same valued pseudos are copies, and copy coalescing we (of > course) do implement. While digging through ira-color.c tracking down an IRA shuffle copy issue, I noticed we only seem to do real copy coalescing for spilled pseudos. It seems we rely on coloring to try and assign the same hard reg to pseudos connected by a copy so the copy can be removed as a nop. Looking at all the code used to do the cost preferencing to achieve that, I'm guessing just coalescing them would be a lot easier. Peter