This is the mail archive of the gcc@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]

Re: -O0 dead code


A little statistics to go with the patch.  In both cases, stage1 was
built with -O1 with some random installed compiler.  Then I timed
stage1 building stage2 cc1 with -O0 -g0.

		BEFORE		AFTER
user time	449		394
sys time	32		32
wall time	2:07		1:55
text size	12685575	10433439

After you get over gawking at how large unoptimized ia64 binaries
are, note that we saved 17% on the size of the binary.  Over 2MB.

Oh, and I have in fact verified that user dead code hangs around.


r~

        * flow.c (life_analysis): Only turn off PROP_LOG_LINKS and
        PROP_AUTOINC at -O0.  Don't collect alias info at -O0.
        (init_propagate_block_info): Don't kill memory stores at -O0.
        (mark_set_1, mark_used_regs): Likewise.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.320
diff -c -p -d -r1.320 flow.c
*** flow.c	2000/08/08 08:27:59	1.320
--- flow.c	2000/08/08 19:42:36
*************** life_analysis (f, file, flags)
*** 2630,2636 ****
  #endif
  
    if (! optimize)
!     flags &= PROP_DEATH_NOTES | PROP_REG_INFO;
  
    /* The post-reload life analysis have (on a global basis) the same
       registers live as was computed by reload itself.  elimination
--- 2630,2636 ----
  #endif
  
    if (! optimize)
!     flags &= ~(PROP_LOG_LINKS | PROP_AUTOINC);
  
    /* The post-reload life analysis have (on a global basis) the same
       registers live as was computed by reload itself.  elimination
*************** life_analysis (f, file, flags)
*** 2646,2652 ****
      flags &= ~(PROP_REG_INFO | PROP_AUTOINC);
  
    /* We want alias analysis information for local dead store elimination.  */
!   if (flags & PROP_SCAN_DEAD_CODE)
      init_alias_analysis ();
  
    /* Always remove no-op moves.  Do this before other processing so
--- 2646,2652 ----
      flags &= ~(PROP_REG_INFO | PROP_AUTOINC);
  
    /* We want alias analysis information for local dead store elimination.  */
!   if (optimize && (flags & PROP_SCAN_DEAD_CODE))
      init_alias_analysis ();
  
    /* Always remove no-op moves.  Do this before other processing so
*************** life_analysis (f, file, flags)
*** 2676,2682 ****
    update_life_info (NULL, UPDATE_LIFE_GLOBAL, flags);
  
    /* Clean up.  */
!   if (flags & PROP_SCAN_DEAD_CODE)
      end_alias_analysis ();
  
    if (file)
--- 2676,2682 ----
    update_life_info (NULL, UPDATE_LIFE_GLOBAL, flags);
  
    /* Clean up.  */
!   if (optimize && (flags & PROP_SCAN_DEAD_CODE))
      end_alias_analysis ();
  
    if (file)
*************** init_propagate_block_info (bb, live, loc
*** 3756,3762 ****
       used later in the block are dead.  So make a pass over the block
       recording any such that are made and show them dead at the end.  We do
       a very conservative and simple job here.  */
!   if ((flags & PROP_SCAN_DEAD_CODE)
        && (bb->succ == NULL
            || (bb->succ->succ_next == NULL
  	      && bb->succ->dest == EXIT_BLOCK_PTR)))
--- 3756,3763 ----
       used later in the block are dead.  So make a pass over the block
       recording any such that are made and show them dead at the end.  We do
       a very conservative and simple job here.  */
!   if (optimize
!       && (flags & PROP_SCAN_DEAD_CODE)
        && (bb->succ == NULL
            || (bb->succ->succ_next == NULL
  	      && bb->succ->dest == EXIT_BLOCK_PTR)))
*************** mark_set_1 (pbi, code, reg, cond, insn, 
*** 4346,4352 ****
  
    /* If this set is a MEM, then it kills any aliased writes. 
       If this set is a REG, then it kills any MEMs which use the reg.  */
!   if (flags & PROP_SCAN_DEAD_CODE)
      {
        if (GET_CODE (reg) == MEM || GET_CODE (reg) == REG)
  	{
--- 4347,4353 ----
  
    /* If this set is a MEM, then it kills any aliased writes. 
       If this set is a REG, then it kills any MEMs which use the reg.  */
!   if (optimize && (flags & PROP_SCAN_DEAD_CODE))
      {
        if (GET_CODE (reg) == MEM || GET_CODE (reg) == REG)
  	{
*************** mark_used_regs (pbi, x, cond, insn)
*** 5321,5327 ****
      case MEM:
        /* Don't bother watching stores to mems if this is not the 
  	 final pass.  We'll not be deleting dead stores this round.  */
!       if (flags & PROP_SCAN_DEAD_CODE)
  	{
            /* Invalidate the data for the last MEM stored, but only if MEM is
  	     something that can be stored into.  */
--- 5322,5328 ----
      case MEM:
        /* Don't bother watching stores to mems if this is not the 
  	 final pass.  We'll not be deleting dead stores this round.  */
!       if (optimize && (flags & PROP_SCAN_DEAD_CODE))
  	{
            /* Invalidate the data for the last MEM stored, but only if MEM is
  	     something that can be stored into.  */

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