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]

[tree-ssa] Fix (hopefully) x86_64 bootstrap failure


Sigh.  Via a wonderful series of events we had an SSA_NAME on the freelist,
but still referenced in the IL.  Not good.

This patch avoids the problem by not removing PHI nodes (and thus freeing
SSA_NAMES) until such point as we can do a full CFG cleanup which
will ensure that all references to dead/unused variables will be wiped
out together.

This makes flow.i build with an x86_64 cross compiler and hopefully brings
it back to bootstrapping status.

I've also bootstrapped and regression tested this on i686-pc-linux-gnu.

	* tree-ssa-dom.c (optimize_stmt): Don't call cleanup_control_expr
	here.  Instead just note that we need to cleanup the cfg (which
	will DTRT).

Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.95
diff -c -3 -p -r1.1.2.95 tree-ssa-dom.c
*** tree-ssa-dom.c	13 Dec 2003 07:20:36 -0000	1.1.2.95
--- tree-ssa-dom.c	14 Dec 2003 01:41:33 -0000
*************** optimize_stmt (struct dom_walk_data *wal
*** 2218,2231 ****
  				   ann);
  
    /* If STMT is a COND_EXPR and it was modified, then we may know
!      where it goes.  In which case we can remove some edges, simplify
!      some PHI nodes, maybe even avoid optimizing some blocks completely,
!      etc.  */
    if (ann->modified)
      {
!       if (TREE_CODE (stmt) == COND_EXPR
! 	  || TREE_CODE (stmt) == SWITCH_EXPR)
! 	cfg_altered |= cleanup_control_expr_graph (bb_for_stmt (stmt), si);
      }
                                                                               

    return may_have_exposed_new_symbols;
--- 2218,2260 ----
  				   ann);
  
    /* If STMT is a COND_EXPR and it was modified, then we may know
!      where it goes.  If that is the case, then mark the CFG as altered.
! 
!      This will cause us to later call remove_unreachable_blocks and
!      cleanup_tree_cfg when it is safe to do so.  It is not safe to 
!      clean things up here since removal of edges and such can trigger
!      the removal of PHI nodes, which in turn can release SSA_NAMEs to
!      the manager.
! 
!      That's all fine and good, except that once SSA_NAMEs are released
!      to the manager, we must not call create_ssa_name until all references
!      to released SSA_NAMEs have been eliminated.
! 
!      All references to the deleted SSA_NAMEs can not be eliminated until
!      we remove unreachable blocks.
! 
!      We can not remove unreachable blocks until after we have completed
!      any queued jump threading.
! 
!      We can not complete any queued jump threads until we have taken
!      appropriate variables out of SSA form.  Taking variables out of
!      SSA form can call create_ssa_name and thus we lose.
! 
!      Ultimately I suspect we're going to need to change the interface
!      into the SSA_NAME manager.  */
! 
    if (ann->modified)
      {
!       tree val = NULL;
! 
!       if (TREE_CODE (stmt) == COND_EXPR)
! 	val = COND_EXPR_COND (stmt);
!       else if (TREE_CODE (stmt) == SWITCH_EXPR)
! 	val = SWITCH_COND (stmt);
! 
!       if (val && TREE_CODE (val) == INTEGER_CST
! 	  && find_taken_edge (bb_for_stmt (stmt), val))
! 	cfg_altered = true;
      }
                                                                               

    return may_have_exposed_new_symbols;



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