This is an archive of the discontinued LLVM Phabricator instance.

[X86][FP16] Fix crash when lowering copysign for f16
ClosedPublic

Authored by pengfei on Jul 7 2022, 8:15 AM.

Details

Summary

This is to address the assertion fail reported in https://reviews.llvm.org/D107082#3635612
Not sure if it is a problem of promoting FCOPYSIGN + libcall FP_ROUND.
The promoting will set the rounding mode to 1 https://github.com/llvm/llvm-project/blob/a442c628882eb07fffff8c9f7c87a317af14555a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L4810-L4814
While libcall cannot handle the rounding mode equals to 1 https://github.com/llvm/llvm-project/blob/a442c628882eb07fffff8c9f7c87a317af14555a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L4324-L4328
So changing the action to Expand to workaround the problem.

Diff Detail

Event Timeline

pengfei created this revision.Jul 7 2022, 8:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 8:15 AM
pengfei requested review of this revision.Jul 7 2022, 8:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 7 2022, 8:15 AM
clementval accepted this revision.Jul 7 2022, 8:19 AM

Thanks for the quick fix.

This revision is now accepted and ready to land.Jul 7 2022, 8:19 AM
MaskRay accepted this revision.Jul 7 2022, 3:03 PM
MaskRay added a subscriber: MaskRay.

Seems that the codegen improves a bit with Expand.

This revision was landed with ongoing or failed builds.Jul 7 2022, 7:17 PM
This revision was automatically updated to reflect the committed changes.