This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix gcc.dg/attr-alwaysinline.c


> On 5/11/06, Jan Hubicka <jh@suse.cz> wrote:
> >Hi,
> >this is regression introduced by my earlier patch to avoid unused static
> >functions to be optimized out.
> >
> >Sorry for that, I must've missed the regression in my testing originally.
> >
> >Also perhaps little discussion should go into whether we want the normal
> >inline functions to be output and what to do about static variables.  At
> >the moment we force all inline functions to be output and we optimize
> >out all unused statics at -O0 (we didn't do that in pre-cgraph world).
> >Both cases are easy to fix if there is reason for doing so.  (in fact I
> >already tested patch).
> >
> >Boostrapped/regtested i686-pc-gnu-linux, will commit it shortly.
> 
> Please check if this also fixes the following ones, which appeared
> along your patch:
> 
> FAIL: gcc.dg/debug/dwarf2/dwarf-die2.c scan-assembler-not CIE Version
> FAIL: gcc.dg/torture/nested-fn-1.c scan-assembler-not should_not_appear
> 
> FAIL: g++.old-deja/g++.other/static14.C (test for excess errors)
> FAIL: g++.old-deja/g++.other/static20.C (test for excess errors)

It doesn't, unforutnately, since i dind't realized I caused even more
breakage. My apologizes for that.

All those tests are testing that functions declared inline and nested
functions are not output when not needed even at -O0 that was partly
true in the original implementation.  The patch attached changes the
behaour of new implementation to imitate it.  This seems safe way around
to me and also leads to slighly faster compilation, but is somewhat
inconsistent.    We might also want to declare testcases illegal and
enfore all static functions to be output (with exception of always
inline and comdats where I think optimizing offline copies is mandatory)

Given the stage3 I will commit the patch in few days since immitating
the original behaviour seems most safe unless someone has good reason
for for doing something else.

Bootstrapped/regtested i686-linux and checked that the testcases are
gone.

2006-05-12  Jan Hubicka  <jh@suse.cz>
	* cgraphunit.c (decide_is_function_needed): Also don't force
	to be output functions declared inline and nested function.
Index: cgraphunit.c
===================================================================
*** cgraphunit.c	(revision 113704)
--- cgraphunit.c	(working copy)
*************** decide_is_function_needed (struct cgraph
*** 219,228 ****
       COMDAT functions that must be output only when they are needed. 
  
       When not optimizing, also output the static functions. (see
!      PR25962), but don't do so for always_inline functions.
!      */
    if (((TREE_PUBLIC (decl)
! 	|| (!optimize && !node->local.disregard_inline_limits))
        && !flag_whole_program)
        && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
      return true;
--- 219,232 ----
       COMDAT functions that must be output only when they are needed. 
  
       When not optimizing, also output the static functions. (see
!      PR25962), but don't do so for always_inline functions, functions
!      declared inline and nested functions.  These was optimized out
!      in the original implementation and it is unclear whether we want
!      to change the behaviour here.  */
    if (((TREE_PUBLIC (decl)
! 	|| (!optimize && !node->local.disregard_inline_limits
! 	    && !DECL_DECLARED_INLINE_P (decl)
! 	    && !node->origin))
        && !flag_whole_program)
        && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
      return true;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]