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

--- Comment #11 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Drea Pinski from comment #10)
> >The test in combine_comparisons checks for any change in trapping behavior, 
> >whereas according to PR tree-optimization/53805 we are allowed to remove 
> >traps,
> 
> No that is what was decided in PR 53805 in the end. I filed PR 126247 where
> in one cases ifcombine removes the trap.

Maybe change the status of 53805 then? It doesn't make much sense for both
53805 and 53806 to be invalid.

For 53806, we could still optimize

  if(a>=b) if(a<=b) return 1;
  return 0;

to

  if(a==b) return 1;
  a<=b; // or any other trapping comparison
  return 0;

If it helps, it could be done in steps, first

  if(a>=b) if(a<=b)

to

  if(a>=b) if(a==b)

then (a>=b && a==b) to (a>=b, a==b)
then moving a>=b after return 1 (it cannot trap in the true branch).

Although I guess that's both more complicated and less important.

Reply via email to