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: [patch] Fix bootstrap


> On Sat, Feb 01, 2003 at 12:10:54AM +0100, Jan Hubicka wrote:
> > I think we can go without it, if we move uninitialized_vars_warning just
> > after life_analysis pass.  Then we will know that the info is valid, as
> > we didn't updated it yet.
> 
> No, that's where it is *now*.  The invalid info comes from the
> previous iteration of *this* life analysis.  Then cleanup_cfg
> removed the block that contained the only reference to the 
> variable.
> 
> Please examine gcc.dg/uninit-10.c for alpha-linux.

I checked this and my patch does not make the warning to come back.
There is no cfg_cleanup in between liveness pass and warnings so at that
time "C" is still normal used variable.  I am running testsuite to check
wehther I didn't introduced anything new now.

The complette patch is attached (now with the toplev.c change)

Sat Feb  1 00:11:18 CET 2003  Jan Hubicka  <jh@suse.cz>

	* basic-block.h (PROP_ALLOW_CFG_CHANGES): Kill.
	(PROP_FINAL): Kill PROP_ALLOW_CFG_CHANGES.
	* flow.c (life_analysis): Kill PROP_ALLOW_CFG_CHANGES code
	* toplev.c (rest_of_compilation):  Do uninitialized warnings just after
	the life_analysis pass.  Add comment.

Index: gcc/basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.168
diff -c -3 -p -r1.168 basic-block.h
*** gcc/basic-block.h	24 Jan 2003 20:27:01 -0000	1.168
--- gcc/basic-block.h	31 Jan 2003 23:00:51 -0000
*************** enum update_life_extent
*** 470,484 ****
  #define PROP_REG_INFO		4	/* Update regs_ever_live et al.  */
  #define PROP_KILL_DEAD_CODE	8	/* Remove dead code.  */
  #define PROP_SCAN_DEAD_CODE	16	/* Scan for dead code.  */
- #define PROP_ALLOW_CFG_CHANGES	32	/* Allow the CFG to be changed
- 					   by dead code removal.  */
  #define PROP_AUTOINC		64	/* Create autoinc mem references.  */
  #define PROP_EQUAL_NOTES	128	/* Take into account REG_EQUAL notes.  */
  #define PROP_SCAN_DEAD_STORES	256	/* Scan for dead code.  */
  #define PROP_FINAL		(PROP_DEATH_NOTES | PROP_LOG_LINKS  \
  				 | PROP_REG_INFO | PROP_KILL_DEAD_CODE  \
  				 | PROP_SCAN_DEAD_CODE | PROP_AUTOINC \
- 				 | PROP_ALLOW_CFG_CHANGES \
  				 | PROP_SCAN_DEAD_STORES)
  
  #define CLEANUP_EXPENSIVE	1	/* Do relativly expensive optimizations
--- 470,481 ----
Index: gcc/flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.548
diff -c -3 -p -r1.548 flow.c
*** gcc/flow.c	31 Jan 2003 06:52:48 -0000	1.548
--- gcc/flow.c	31 Jan 2003 23:00:52 -0000
*************** life_analysis (f, file, flags)
*** 444,450 ****
  #endif
  
    if (! optimize)
!     flags &= ~(PROP_LOG_LINKS | PROP_AUTOINC | PROP_ALLOW_CFG_CHANGES);
  
    /* The post-reload life analysis have (on a global basis) the same
       registers live as was computed by reload itself.  elimination
--- 444,450 ----
  #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
*************** update_life_info (blocks, extent, prop_f
*** 644,709 ****
    timevar_push ((extent == UPDATE_LIFE_LOCAL || blocks)
  		? TV_LIFE_UPDATE : TV_LIFE);
  
-   /* Changes to the CFG are only allowed when
-      doing a global update for the entire CFG.  */
-   if ((prop_flags & PROP_ALLOW_CFG_CHANGES)
-       && (extent == UPDATE_LIFE_LOCAL || blocks))
-     abort ();
- 
    /* For a global update, we go through the relaxation process again.  */
    if (extent != UPDATE_LIFE_LOCAL)
      {
!       for ( ; ; )
! 	{
! 	  int changed = 0;
! 
! 	  calculate_global_regs_live (blocks, blocks,
! 				prop_flags & (PROP_SCAN_DEAD_CODE
! 					      | PROP_SCAN_DEAD_STORES
! 					      | PROP_ALLOW_CFG_CHANGES));
! 
! 	  if ((prop_flags & (PROP_KILL_DEAD_CODE | PROP_ALLOW_CFG_CHANGES))
! 	      != (PROP_KILL_DEAD_CODE | PROP_ALLOW_CFG_CHANGES))
! 	    break;
! 
! 	  /* Removing dead code may allow the CFG to be simplified which
! 	     in turn may allow for further dead code detection / removal.  */
! 	  FOR_EACH_BB_REVERSE (bb)
! 	    {
! 	      COPY_REG_SET (tmp, bb->global_live_at_end);
! 	      changed |= propagate_block (bb, tmp, NULL, NULL,
! 				prop_flags & (PROP_SCAN_DEAD_CODE
! 					      | PROP_SCAN_DEAD_STORES
! 					      | PROP_KILL_DEAD_CODE));
! 	    }
! 
! 	  /* Don't pass PROP_SCAN_DEAD_CODE or PROP_KILL_DEAD_CODE to
! 	     subsequent propagate_block calls, since removing or acting as
! 	     removing dead code can affect global register liveness, which
! 	     is supposed to be finalized for this call after this loop.  */
! 	  stabilized_prop_flags
! 	    &= ~(PROP_SCAN_DEAD_CODE | PROP_SCAN_DEAD_STORES
! 		 | PROP_KILL_DEAD_CODE);
! 
! 	  if (! changed)
! 	    break;
! 
! 	  /* We repeat regardless of what cleanup_cfg says.  If there were
! 	     instructions deleted above, that might have been only a
! 	     partial improvement (see MAX_MEM_SET_LIST_LEN usage).
! 	     Further improvement may be possible.  */
! 	  cleanup_cfg (CLEANUP_EXPENSIVE);
! 
! 	  /* Zap the life information from the last round.  If we don't 
! 	     do this, we can wind up with registers that no longer appear
! 	     in the code being marked live at entry, which twiggs bogus
! 	     warnings from regno_uninitialized.  */
! 	  FOR_EACH_BB (bb)
! 	    {
! 	      CLEAR_REG_SET (bb->global_live_at_start);
! 	      CLEAR_REG_SET (bb->global_live_at_end);
! 	    }
! 	}
  
        /* If asked, remove notes from the blocks we'll update.  */
        if (extent == UPDATE_LIFE_GLOBAL_RM_NOTES)
--- 644,655 ----
    timevar_push ((extent == UPDATE_LIFE_LOCAL || blocks)
  		? TV_LIFE_UPDATE : TV_LIFE);
  
    /* For a global update, we go through the relaxation process again.  */
    if (extent != UPDATE_LIFE_LOCAL)
      {
!       calculate_global_regs_live (blocks, blocks,
! 			    prop_flags & (PROP_SCAN_DEAD_CODE
! 					  | PROP_SCAN_DEAD_STORES));
  
        /* If asked, remove notes from the blocks we'll update.  */
        if (extent == UPDATE_LIFE_GLOBAL_RM_NOTES)
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.703
diff -c -3 -p -r1.703 toplev.c
*** toplev.c	26 Jan 2003 14:40:15 -0000	1.703
--- toplev.c	1 Feb 2003 01:57:00 -0000
*************** rest_of_compilation (decl)
*** 3109,3127 ****
    verify_flow_info ();
  #endif
    life_analysis (insns, rtl_dump_file, PROP_FINAL);
-   if (optimize)
-     cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_UPDATE_LIFE
- 		 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
-   timevar_pop (TV_FLOW);
- 
-   no_new_pseudos = 1;
  
    if (warn_uninitialized || extra_warnings)
      {
        uninitialized_vars_warning (DECL_INITIAL (decl));
        if (extra_warnings)
  	setjmp_args_warning ();
      }
  
    if (optimize)
      {
--- 3109,3130 ----
    verify_flow_info ();
  #endif
    life_analysis (insns, rtl_dump_file, PROP_FINAL);
  
+   /*  Only just after first life analysis liveness is actually correct.
+       After updating it registers may be live for no reason provoking wrong
+       warnings.  */
    if (warn_uninitialized || extra_warnings)
      {
        uninitialized_vars_warning (DECL_INITIAL (decl));
        if (extra_warnings)
  	setjmp_args_warning ();
      }
+   if (optimize)
+     cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_UPDATE_LIFE
+ 		 | (flag_thread_jumps ? CLEANUP_THREADING : 0));
+   timevar_pop (TV_FLOW);
+ 
+   no_new_pseudos = 1;
  
    if (optimize)
      {


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