This is an archive of the discontinued LLVM Phabricator instance.

Remove NaN constant from arith.minf, arith.maxf expansion
ClosedPublic

Authored by csigg on Jan 11 2022, 4:17 AM.

Details

Summary

If any of the operands is NaN, return the operand instead of a new constant.

When the rhs operand is a constant, the second arith.cmpf+select ops will be folded away.

https://reviews.llvm.org/D117010 marks the two ops commutative, which will place the constant on the rhs.

Diff Detail

Event Timeline

csigg created this revision.Jan 11 2022, 4:17 AM
csigg requested review of this revision.Jan 11 2022, 4:17 AM
herhut added inline comments.Jan 11 2022, 6:06 AM
mlir/lib/Dialect/Arithmetic/Transforms/ExpandOps.cpp
164–165

Can you add a comment, why it suffices to check the rhs? Also, this is only true of the unordered comparisons are used. Maybe add an assert to make sure this is not changed.

csigg updated this revision to Diff 398975.Jan 11 2022, 9:01 AM

Add assert and comment.

csigg marked an inline comment as done.Jan 11 2022, 9:01 AM
herhut accepted this revision.Jan 11 2022, 9:06 AM

Thanks!

This revision is now accepted and ready to land.Jan 11 2022, 9:06 AM
This revision was landed with ongoing or failed builds.Jan 12 2022, 11:56 AM
This revision was automatically updated to reflect the committed changes.