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: [tree-ssa] EH cleanup patch


In message <1055859320.8784.1098.camel@p4>, Andrew MacLeod writes:
 >On Mon, 2003-06-16 at 22:14, law@redhat.com wrote:
 >> 
 >> This patch improves our handling of EH cleanups.  It can significantly
 >> reduce the number of edges in the CFG in the presence of cleanups and
 >> as a result can significantly speed up the tree-ssa optimizers.
 >> 
 >> Bootstrapped, regression tested i686-pc-linux-gnu.
 >> 
 >> [ Note there is a follow-up patch which removes a few more edges, but
 >>   that is blocked behind an insert_insn_on_edge bug. ]
 >> 
 >
 >OK, give this a try. I tried a few combinations, and I think I got them
 >all. We'll see :-)  Hopefullt it does what it is suppose to do.
 >
 >Along the way, I fixed a bug in the CFG builder.. It wasn't removing the
 >edge from the SWITCH_EXPR to the fallthrough block unless the default
 >case label was the first case in a list.. ie
 >
 >  case 42:
 >  default:
 >    ....
 >
 >wasn't being found, so it wasn't removing the fallthrough edge.
 >
 >Someone ought to remove the case 42: at some point too I suppose.
 >
 >
 >Anyway, give this a try. I handled 3 or 4 different situations in it. Im
 >currently running regressions, I fugured you'd want it ASAP :-)
 >
 >Andrew
 >
 >
 >	* tree-cfg.c (handle_switch_fallthru): New. Handle fallthru from switch
 >.
 >	(bsi_committing_edge_insertions): New. Ststic indicating whether edge
 >	insertion is happening on demand or by queued edge lists.
 >	(cleanup_switch_expr_graph): Remove fallthru edge if default label
 >	is anywhere in the case label list.
 >	(find_insert_location): Call handle_switch_fallthru when appropriate.
 >	(bsi_commit_edge_inserts): Set bsi_committing_edge_insertion flag.
 >	* tree-iterator.h (tsi_last): New. Set TSI to last stmt in a chain.
I get an abort in bsi_insert_after:
      curr_stmt = NULL_TREE;
      parent = NULL_TREE;
                                                                                
      /* bsi_start () will initialize the context pointer to the basic block
         if the the block is completely devoid of instructions, except
         for possibly an empty statement node.  */
      if (curr_bsi->tp == NULL && curr_bsi->context != NULL)
        curr_bb = (basic_block)(curr_bsi->context);
      else
        abort ();

(gdb) p *curr_bsi
$2 = {tp = 0x0, context = 0x0}

We've successfully inserted a copy on the edge from block 7 to block 10 via
the call to bsi_insert_on_edge_immediate within bsi_commit_edge_insertes.

However, inside bsi_insert_on_edge_immediate we have the following code:

  append_stmt_to_bb (tsi_container (tsi), new_bb, parent);
  inserted_stmt = tsi_stmt (tsi);
  bsi = bsi_from_tsi (tsi);

It appears that bsi_from_tsi (tsi) is returning an empty block statement
iterator, which we gladly pass along.

Jeff


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