https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/170583
None >From 064887b3b6efb968ae9131bd976b0727a0815cb2 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Wed, 3 Dec 2025 23:09:09 +0100 Subject: [PATCH] DAG: Avoid using getLibcallName for function support test --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 8 ++++---- llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | 7 ++++--- llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 8336e1d1f4134..2d2d39dab864a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -3878,7 +3878,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) { RTLIB::Libcall LC = RTLIB::getLDEXP(VT); // Use the LibCall instead, it is very likely faster // FIXME: Use separate LibCall action. - if (TLI.getLibcallName(LC)) + if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported) break; if (SDValue Expanded = expandLdexp(Node)) { @@ -3893,7 +3893,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) { RTLIB::Libcall LC = RTLIB::getFREXP(Node->getValueType(0)); // Use the LibCall instead, it is very likely faster // FIXME: Use separate LibCall action. - if (TLI.getLibcallName(LC)) + if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported) break; if (SDValue Expanded = expandFrexp(Node)) { @@ -4695,7 +4695,7 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) { RTLIB::Libcall LC = RTLIB::getOUTLINE_ATOMIC(Opc, Order, VT); EVT RetVT = Node->getValueType(0); SmallVector<SDValue, 4> Ops; - if (TLI.getLibcallName(LC)) { + if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported) { // If outline atomic available, prepare its arguments and expand. Ops.append(Node->op_begin() + 2, Node->op_end()); Ops.push_back(Node->getOperand(1)); @@ -4961,7 +4961,7 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) { case ISD::STRICT_FPOWI: { RTLIB::Libcall LC = RTLIB::getPOWI(Node->getSimpleValueType(0)); assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fpowi."); - if (!TLI.getLibcallName(LC)) { + if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) { // Some targets don't have a powi libcall; use pow instead. if (Node->isStrictFPOpcode()) { SDValue Exponent = diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index 383a025a4d916..dbdd913fccdb2 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -717,7 +717,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_ExpOp(SDNode *N) { RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI(N->getValueType(0)) : RTLIB::getLDEXP(N->getValueType(0)); assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fpowi."); - if (!TLI.getLibcallName(LC)) { + if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) { // Some targets don't have a powi libcall; use pow instead. // FIXME: Implement this if some target needs it. DAG.getContext()->emitError("do not know how to soften fpowi to fpow"); @@ -802,7 +802,7 @@ bool DAGTypeLegalizer::SoftenFloatRes_UnaryWithTwoFPResults( assert(VT == N->getValueType(1) && "expected both return values to have the same type"); - if (!TLI.getLibcallName(LC)) + if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) return false; EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT); @@ -862,7 +862,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FSINCOS(SDNode *N) { RTLIB::Libcall CosLC = RTLIB::getCOS(VT); SDValue SoftSin, SoftCos; - if (!TLI.getLibcallName(SinLC) || !TLI.getLibcallName(CosLC)) { + if (TLI.getLibcallImpl(SinLC) == RTLIB::Unsupported || + TLI.getLibcallImpl(CosLC) == RTLIB::Unsupported) { DAG.getContext()->emitError("do not know how to soften fsincos"); EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT); diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index 0160723553a8e..8c9f5eeebd26c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -2692,7 +2692,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_ExpOp(SDNode *N) { RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI(N->getValueType(0)) : RTLIB::getLDEXP(N->getValueType(0)); - if (LC == RTLIB::UNKNOWN_LIBCALL || !TLI.getLibcallName(LC)) { + if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) { // Scalarize vector FPOWI instead of promoting the type. This allows the // scalar FPOWIs to be visited and converted to libcalls before promoting // the type. _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
