This is an archive of the discontinued LLVM Phabricator instance.

InstSimplify: Fold fdiv nnan ninf x, 0 -> poison
ClosedPublic

Authored by arsenm on Oct 17 2022, 11:17 AM.

Details

Diff Detail

Event Timeline

arsenm created this revision.Oct 17 2022, 11:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 17 2022, 11:17 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
arsenm requested review of this revision.Oct 17 2022, 11:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 17 2022, 11:17 AM
Herald added a subscriber: wdng. · View Herald Transcript
kpn accepted this revision.Oct 17 2022, 11:29 AM

Looks like IEEE 754-2019 section 7.3 says this should result in Infinity, but the ninf flag excludes Infinity, so poison seems correct.

LGTM

This revision is now accepted and ready to land.Oct 17 2022, 11:29 AM
spatel added inline comments.Oct 17 2022, 11:32 AM
llvm/test/Transforms/InstSimplify/fdiv.ll
64

This Alive2 link is showing folding to infinity rather than poison. Please adjust. Also, add the amended link to the patch summary/commit message?

arsenm added inline comments.Oct 17 2022, 11:38 AM
llvm/test/Transforms/InstSimplify/fdiv.ll
64

This link is in a pre-commit to add new tests, I'll fix it there

spatel accepted this revision.Oct 17 2022, 11:50 AM
spatel added inline comments.
llvm/test/Transforms/InstSimplify/fdiv.ll
64

That works.