[Bug tree-optimization/91425] Ordered compares aren't optimised

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 12 13:12:00 GMT 2019


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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #4)
> (In reply to Richard Biener from comment #1)
> > where we end up with
> > 
> >   <bb 2> [local count: 1073741824]:
> >   if (a_3(D) < b_4(D))
> >     goto <bb 4>; [50.00%]
> >   else
> >     goto <bb 3>; [50.00%]
> > 
> >   <bb 3> [local count: 536870913]:
> >   _6 = a_3(D) > b_4(D);
> > 
> >   <bb 4> [local count: 1073741824]:
> >   # prephitmp_8 = PHI <_6(3), 1(2)>
> > 
> > instead of != compares.
> 
> instead of <> compares (LTGT).  With -ffast-math we should get the NE as
> you say, and that works fine.

Ah, OK.  So there it's ifcombine doing the thing thus enhancing that would work
(only after it failed phiopt comes along and replaces the inner conditional
with the value compute).  ifcombine does use maybe_fold_and_comparisons,
indeed relying on invert_tree_comparison as well.


More information about the Gcc-bugs mailing list