[Bug ada/26796] [4.2 Regression] ACATS ICE c34002a c52005 spurious storage_error

Jeffrey A Law law@redhat.com
Tue Mar 28 15:38:00 GMT 2006


On Wed, 2006-03-22 at 19:28 +0000, ebotcazou at gcc dot gnu dot org
wrote:
> 
> ------- Comment #2 from ebotcazou at gcc dot gnu dot org  2006-03-22 19:27 -------
> The 2 failures have been introduced by the following change:
> 
> 2006-03-20  Jeff Law  <law@redhat.com>
> 
>         * tree-pass.h (pass_phi_only_copy_prop): Delete.
>         (pass_phi_only_cprop): Declare.
>         * passes.c (init_optimization_passes): Replace pass_phi_only_copy_prop
>         with phi_only_cprop
>         * tree-ssa-dom.c (degenerate_phi_result): New function.
>         (remove_stmt_or_phi, get_lhs_or_phi_result): Likewise.
>         (get_rhs_or_phi_arg, propagate_rhs_into_lhs): Likewise.
>         (eliminate_const_or_copy, eliminate_degenerate_phis_1): Likewise.
>         (eliminate_degenerate_phis): Likewise.
>         (pass_phi_only_cprop): New pass descriptor.
>         * tree-ssa-copy.c (init_copy_prop): Lose PHIS_ONLY argument and
>         support code.  Callers updated.
>         (execute_copy_prop, do_copy_prop): Likewise and corresponding changes.
>         (store_copy_prop): Likewise.
>         (do_phi_only_copy_prop, pass_phi_only_copy_prop): Remove.

The problem is that phi-cprop managed to perform some propagations
which ultimately led it to proving certain EH edges were not executable.

So we dutifully purged the EH edges, which in turn wiped out the
dominator tree.  Opps.  I wasn't aware of that little tidbit
(forwprop doesn't use the DOM tree, so it doesn't have this
issue).

As it turns out DOM already has a mechanism to deal with queued
blocks needing EH edge cleanups.  So I tweaked the phi-cprop
pass to use that existing mechanism.

Bootstrapped and regression tested on i686-pc-linux-gnu (ada included).
Fixes c340002a and c52005.


-------------- next part --------------
	PR tree-optimization/26796
	* tree-ssa-dom.c (propagate_rhs_into_lhs): Queue blocks which
	need EH edge cleanups rather than purging them immediately.
	(eliminate_degenerate_phis): Handle queued EH cleanups.

Index: tree-ssa-dom.c
===================================================================
*** tree-ssa-dom.c	(revision 112451)
--- tree-ssa-dom.c	(working copy)
*************** propagate_rhs_into_lhs (tree stmt, tree 
*** 2181,2190 ****
  	    recompute_tree_invariant_for_addr_expr (TREE_OPERAND (use_stmt, 1));
  
  	  /* If we cleaned up EH information from the statement,
!              remove EH edges.  I'm not sure if this happens in 
! 	     practice with this code, but better safe than sorry.  */
  	  if (maybe_clean_or_replace_eh_stmt (use_stmt, use_stmt))
! 	    tree_purge_dead_eh_edges (bb_for_stmt (use_stmt));
  
  	  /* Propagation may expose new degenerate PHIs or
  	     trivial copy/constant propagation opportunities.  */
--- 2181,2193 ----
  	    recompute_tree_invariant_for_addr_expr (TREE_OPERAND (use_stmt, 1));
  
  	  /* If we cleaned up EH information from the statement,
! 	     mark its containing block as needing EH cleanups.  */
  	  if (maybe_clean_or_replace_eh_stmt (use_stmt, use_stmt))
! 	    {
! 	      bitmap_set_bit (need_eh_cleanup, bb_for_stmt (use_stmt)->index);
! 	      if (dump_file && (dump_flags & TDF_DETAILS))
! 		fprintf (dump_file, "  Flagged to clear EH edges.\n");
! 	    }
  
  	  /* Propagation may expose new degenerate PHIs or
  	     trivial copy/constant propagation opportunities.  */
*************** eliminate_degenerate_phis (void)
*** 2392,2397 ****
--- 2395,2404 ----
  {
    bitmap interesting_names;
  
+   /* Bitmap of blocks which need EH information updated.  We can not
+      update it on-the-fly as doing so invalidates the dominator tree.  */
+   need_eh_cleanup = BITMAP_ALLOC (NULL);
+ 
    /* INTERESTING_NAMES is effectively our worklist, indexed by
       SSA_NAME_VERSION.
  
*************** eliminate_degenerate_phis (void)
*** 2436,2441 ****
--- 2443,2456 ----
  	}
      }
  
+   /* Propagation of const and copies may make some EH edges dead.  Purge
+      such edges from the CFG as needed.  */
+   if (!bitmap_empty_p (need_eh_cleanup))
+     {
+       cfg_altered |= tree_purge_all_dead_eh_edges (need_eh_cleanup);
+       BITMAP_FREE (need_eh_cleanup);
+     }
+ 
    BITMAP_FREE (interesting_names);
    if (cfg_altered)
      free_dominance_info (CDI_DOMINATORS);


More information about the Gcc-patches mailing list