https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110891

--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> ---
On Sat, 26 Aug 2023, pinskia at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110891
> 
> --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> (In reply to Andrew Pinski from comment #3)
> > One thing I noticed (I don't know if causes the missed optimization) is that
> > we have before PRE:
> > ```
> >   <bb 4> [local count: 1073531371]:
> >   if (a.0_1 != 0)
> >     goto <bb 6>; [50.00%]
> >   else
> >     goto <bb 5>; [50.00%]
> > 
> >   <bb 5> [local count: 536765686]:
> >   if (_28 == &d)
> >     goto <bb 9>; [30.00%]
> >   else
> >     goto <bb 7>; [70.00%]
> > 
> >   <bb 6> [local count: 536765685]:
> >   if (_28 == &d)
> >     goto <bb 9>; [30.00%]
> >   else
> >     goto <bb 7>; [70.00%]
> > ```
> > Which obvious should just be `if (_28 == &d) goto bb9; else goto bb7;` and
> > not check `a.0_1` at all.
> 
> I wonder if ifcombine could optimize that instead of requiring PRE. I think
> that might even fix the issue too.

Note it's the tail-merging code that optimizes this, not PRE (yeah,
those passes should be ripped apart)

Reply via email to