On Tue, 15 Feb 2022, Jan Hubicka wrote:

> > @@ -1272,7 +1275,7 @@ maybe_optimize_arith_overflow (gimple_stmt_iterator 
> > *gsi,
> >     contributes nothing to the program, and can be deleted.  */
> >  
> >  static bool
> > -eliminate_unnecessary_stmts (void)
> > +eliminate_unnecessary_stmts (bool aggressive)
> >  {
> >    bool something_changed = false;
> >    basic_block bb;
> > @@ -1366,7 +1369,9 @@ eliminate_unnecessary_stmts (void)
> >                       break;
> >                     }
> >                 }
> > -             if (!dead)
> > +             if (!dead
> > +                 && (!aggressive
> > +                     || bitmap_bit_p (visited_control_parents, bb->index)))
> 
> It seems to me that it may be worth to consider case where
> visited_control_parents is 0 while all basic blocks in the CD relation
> are live for different reasons.  I suppose this can happen in more
> complex CFGs when the other arms of conditionals are live...

It's a bit difficult to do in this place though since we might already
have altered those blocks (and we need to check not for the block being
live but for its control stmt).  I suppose we could use the
last_stmt_necessary bitmap.  I'll do some statistics to see whether
this helps.

Richard.

Reply via email to