[llvm] [SDAG] Merge multiple-result libcall expansion into DAG.expandMultipleResultFPLibCall() (PR #114792)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 05:43:02 PST 2024


================
@@ -4562,10 +4520,11 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
     ExpandFPLibCall(Node, RTLIB::TANH_F32, RTLIB::TANH_F64, RTLIB::TANH_F80,
                     RTLIB::TANH_F128, RTLIB::TANH_PPCF128, Results);
     break;
-  case ISD::FSINCOS:
-    // Expand into sincos libcall.
-    (void)DAG.expandFSINCOS(Node, Results);
+  case ISD::FSINCOS: {
+    RTLIB::Libcall LC = RTLIB::getFSINCOS(Node->getValueType(0));
+    DAG.expandMultipleResultFPLibCall(LC, Node, Results);
----------------
MacDue wrote:

I've added some `llvm_unreachable` checks now. This expansion can't fail for scalar types (which are the only types possible here). The failure case is only possible for vector types in `VectorLegalizer::Expand` (if a corresponding vector function can't be found) -- in which case it attempts to unroll the vector operation. 

https://github.com/llvm/llvm-project/pull/114792


More information about the llvm-commits mailing list