This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Fix ConvertNodeToLibcall for STRICT_FPOWI
ClosedPublic

Authored by xiangzhangllvm on May 7 2022, 1:30 AM.

Details

Summary

Correct the Operand index when convert STRICT_FPOWI to FPOW.
(the old code miss considering the chain operand of STRICT_FPOWI, will cause crash.)

Diff Detail

Event Timeline

xiangzhangllvm created this revision.May 7 2022, 1:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2022, 1:30 AM
xiangzhangllvm requested review of this revision.May 7 2022, 1:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2022, 1:30 AM
pengfei added inline comments.May 7 2022, 1:47 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
4100–4101

We should generate STRICT_SINT_TO_FP and STRICT_FPOWI for strict node and push the output chain into Results.

xiangzhangllvm added inline comments.May 7 2022, 1:55 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
4100–4101

Here is already STRICT_FPOWI, and the Target has no libcall for STRICT_FPOWI

pengfei added inline comments.May 7 2022, 4:35 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
4100–4101

Oh, I meant STRICT_FPOW...

xiangzhangllvm added inline comments.May 8 2022, 6:29 PM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
4100–4101

En., Make sense : )

Address pengfei's comment.

pengfei added inline comments.May 9 2022, 1:24 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
4106–4109

You still need to push the chain, like line 3870.

llvm/test/CodeGen/X86/float-strict-powi-convert.ll
3

We don't use it anymore.

xiangzhangllvm added inline comments.May 9 2022, 2:02 AM
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
4106–4109

good catch!

llvm/test/CodeGen/X86/float-strict-powi-convert.ll
3

Not use what ? the windows check is needed to meet the if condition ( line 4101 if (Node->isStrictFPOpcode()))

pengfei added inline comments.May 9 2022, 2:10 AM
llvm/test/CodeGen/X86/float-strict-powi-convert.ll
3

-disable-strictnode-mutation. X86 supports strict FP by default. This option is used for targets only support it partly.

Address pengfei's comment

pengfei accepted this revision.May 10 2022, 8:20 AM

LGTM.

This revision is now accepted and ready to land.May 10 2022, 8:20 AM
This revision was landed with ongoing or failed builds.May 10 2022, 5:58 PM
This revision was automatically updated to reflect the committed changes.