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

--- Comment #5 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #4)
> (In reply to Drea Pinski from comment #3)
> > So this looks like this is optimized due to frange work.
> > That is dom and evrp change `a<=b` into `a==b` and then ifcombine/phiopt can
> > handle that.
> 
> well not exactly because we don't combine then until reassociation because
> of:
> 
> ```
>       /* If we changed the conditions that cause a trap, we lose.  */
>       if ((ltrap || rtrap) != trap)
>         return NULL_TREE;
> ```
> 
> Which I think this should be if we had didn't have a trap, don't introduce a
> trap.
> 
> So this should be:
> ```
> if (!ltrap && !rtrap && trap)
>   return NULL_TREE;
> ```
> 
> Let me try that; that will allow phiopt to optimize it without
> reassociation. (with the fix for PR 106164).
> 
> As far without the transformation of `a <= b` into `a == b`; I have an idea
> on how to fix that and will be implementing it. But maybe the above change
> will fix it too because we had 2 that traped before and none now.

I mean `a>=b` & `a<=b` can trap but `a == b` does not. And we the above change
should allow for that optimization too IIRC.

Reply via email to