https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91425
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2019-08-12
Component|middle-end |tree-optimization
Version|unknown |10.0
Summary|Ordered compares aren't |Ordered compares aren't
|optimised properly |optimised
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. No idea why improving GIMPLE is a requirement for making targets
behave better though.
Btw, on x86_64 ll and llx would have to be handled by phiopt since we have
for example
ll (double a, double b)
{
_Bool _6;
_Bool prephitmp_8;
<bb 2> [local count: 1073741824]:
if (a_3(D) u>= b_4(D))
goto <bb 3>; [50.00%]
else
goto <bb 4>; [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)>
return prephitmp_8;
maybe_fold_or_comparisons could be used here eventually. Btw. it's the
same missed optimization for non-ordered:
_Bool lt(double a, double b) { return a > b; }
_Bool lo(double a, double b) { return a < b; }
_Bool ll(double a, double b) { return lt(a,b) || lo(a,b); }
_Bool lx(double a, double b) { return lo(a,b) || lt(a,b); }
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.