Page MenuHomePhabricator

[InstSimplify] fold 'fcmp nnan oge X, 0.0' when X is not negative

Authored by spatel on Oct 30 2018, 10:22 AM.



This re-raises some of the open questions about how to apply and use fast-math-flags in IR from PR38086:
...but given the current implementation, I think this is the correct way to predicate the transform.

This is part of solving PR39475:

Diff Detail


Event Timeline

spatel created this revision.Oct 30 2018, 10:22 AM
mcberg2017 added inline comments.Oct 30 2018, 11:21 AM
3573 ↗(On Diff #171727)

Sure NaNs are compared as unordered so excluding them is ok. Discussion point: If X has value below -0.0, CannotBeOrderedLessThanZero will return false if it can prove it, however so will the comparison of X > 0 as an ordered compare. Now we no longer have to prove X is a NaN in CannotBeOrderedLessThanZero as we specify/assert it is not. Do we need CannotBeOrderedLessThanZero for this comparison?

spatel added inline comments.Oct 30 2018, 1:08 PM
3573 ↗(On Diff #171727)

I'm not seeing the alternative to using CannotBeOrderedLessThanZero for this case. Did you have something in mind?
I agree that we're probably missing an additional fold for 'OLT' and/or 'ULT' here, but I wanted to make sure we're ok with this example first.

mcberg2017 added inline comments.Oct 30 2018, 1:17 PM
3573 ↗(On Diff #171727)

Not per say other than usage, having it is harmless at a small cost.

mcberg2017 accepted this revision.Oct 30 2018, 1:17 PM
This revision is now accepted and ready to land.Oct 30 2018, 1:17 PM
This revision was automatically updated to reflect the committed changes.