GCSE botch with EH case

Daniel Berlin dberlin@dberlin.org
Sat Aug 14 17:07:00 GMT 2004


On Aug 14, 2004, at 12:42 PM, Richard Kenner wrote:

>> the EH case that wasn't there in the the normal case.  I don't at all
>> understand what this store motion is all about.  Not only does it
>> appear incorrect, but I don't see how it's an "optimization".
>
>
>     It looks like some code that handles this in compute_pre_data 
> needs to
>     be added to build_store_vectors, but it also could be some local
>     patches in your tree.
>
> I don't have any patches to the RTL optimizers, so it's not likely 
> *caused*
> by any local patches, though it could easily be a latent problem 
> exposed by
> them.  However, this ACATS test was also failing on July 30, so it 
> wasn't
> anything *too* recent.
>
> Can you point to the exact code you're talking about?  Perhaps I can 
> try
> what you're suggesting and see what happens.



in compute_pre_data, we do this:

  /* Collect expressions which might trap.  */
   trapping_expr = sbitmap_alloc (expr_hash_table.n_elems);
   sbitmap_zero (trapping_expr);
   for (ui = 0; ui < expr_hash_table.size; ui++)
     {
       struct expr *e;
       for (e = expr_hash_table.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)
   */

   FOR_EACH_BB (bb)
     {
       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 = bb->pred; e ; e = e->pred_next)
   if (e->flags & EDGE_ABNORMAL)
     {
       sbitmap_difference (antloc[bb->index], antloc[bb->index], 
trapping_expr);
       sbitmap_difference (transp[bb->index], transp[bb->index], 
trapping_expr);
       break;
     }

... <the few lines here aren't necessary for store motion>
     }



This causes trapping expressions to be not transparent/antic in blocks 
whose predecessors are abnormal.
For store motion, you need to do the same, except they can't be 
transparent/antic in blocks whose successor edges are abnormal edges.
This will prevent it from pushing stores down across abnormal edges.
For store motion, it would be st_antloc. and you'll have to walk the 
stores list using first_ls_expr/next_ls_expr to find the trapping 
expressions, rather than the hash table.



More information about the Gcc mailing list