Fix for GCSE and abnormal edges

Richard Henderson rth@redhat.com
Wed Dec 6 10:46:00 GMT 2000


On Wed, Dec 06, 2000 at 11:27:20AM +0100, Michael Matz wrote:
> 	* gcse.c (compute_pre_data): New locals abnormal_dests, trapping_expr.
> 	Use them to kill trapping expressions in destination blocks of
> 	abnormal edges.

Thanks.

I don't see the point of computing a bitmap for abnormal_dests
as opposed to just computing what we need when it is needed.

So I've tweeked the patch as follows.  Committed.


r~



Index: gcse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcse.c,v
retrieving revision 1.111
diff -c -p -d -r1.111 gcse.c
*** gcse.c	2000/11/21 21:00:20	1.111
--- gcse.c	2000/12/06 18:41:54
*************** free_pre_mem ()
*** 4157,4167 ****
--- 4157,4180 ----
  static void
  compute_pre_data ()
  {
+   sbitmap trapping_expr;
    int i;
+   unsigned int ui;
  
    compute_local_properties (transp, comp, antloc, 0);
    sbitmap_vector_zero (ae_kill, n_basic_blocks);
  
+   /* Collect expressions which might trap.  */
+   trapping_expr = sbitmap_alloc (n_exprs);
+   sbitmap_zero (trapping_expr);
+   for (ui = 0; ui < expr_hash_table_size; ui++)
+     {
+       struct expr *e;
+       for (e = expr_hash_table[ui]; e != NULL; e = e->next_same_hash)
+ 	if (may_trap_p (e->expr))
+ 	  SET_BIT (trapping_expr, e->bitmap_index);
+     }
+ 
    /* Compute ae_kill for each basic block using:
  
       ~(TRANSP | COMP)
*************** compute_pre_data ()
*** 4170,4175 ****
--- 4183,4202 ----
  
    for (i = 0; i < n_basic_blocks; i++)
      {
+       edge e;
+ 
+       /* If the current block is the destination of an abnormal edge, we
+ 	 kill all trapping expressions because we won't be able to properly
+ 	 place the instruction on the edge.  So make them neither
+ 	 anticipatable nor transparent.  This is fairly conservative.  */
+       for (e = BASIC_BLOCK (i)->pred; e ; e = e->pred_next)
+ 	if (e->flags & EDGE_ABNORMAL)
+ 	  {
+ 	    sbitmap_difference (antloc[i], antloc[i], trapping_expr);
+ 	    sbitmap_difference (transp[i], transp[i], trapping_expr);
+ 	    break;
+ 	  }
+ 
        sbitmap_a_or_b (ae_kill[i], transp[i], comp[i]);
        sbitmap_not (ae_kill[i], ae_kill[i]);
      }
*************** compute_pre_data ()
*** 4180,4185 ****
--- 4207,4213 ----
    antloc = NULL;
    free (ae_kill);
    ae_kill = NULL; 
+   free (trapping_expr);
  }
  
  /* PRE utilities */


More information about the Gcc-patches mailing list