Skip to content

Commit ac56d6e

Browse files
authored
DAG: Avoid using getLibcallName for function support test (#170583)
1 parent 6283259 commit ac56d6e

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,7 +3878,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
38783878
RTLIB::Libcall LC = RTLIB::getLDEXP(VT);
38793879
// Use the LibCall instead, it is very likely faster
38803880
// FIXME: Use separate LibCall action.
3881-
if (TLI.getLibcallName(LC))
3881+
if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported)
38823882
break;
38833883

38843884
if (SDValue Expanded = expandLdexp(Node)) {
@@ -3893,7 +3893,7 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
38933893
RTLIB::Libcall LC = RTLIB::getFREXP(Node->getValueType(0));
38943894
// Use the LibCall instead, it is very likely faster
38953895
// FIXME: Use separate LibCall action.
3896-
if (TLI.getLibcallName(LC))
3896+
if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported)
38973897
break;
38983898

38993899
if (SDValue Expanded = expandFrexp(Node)) {
@@ -4695,7 +4695,7 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
46954695
RTLIB::Libcall LC = RTLIB::getOUTLINE_ATOMIC(Opc, Order, VT);
46964696
EVT RetVT = Node->getValueType(0);
46974697
SmallVector<SDValue, 4> Ops;
4698-
if (TLI.getLibcallName(LC)) {
4698+
if (TLI.getLibcallImpl(LC) != RTLIB::Unsupported) {
46994699
// If outline atomic available, prepare its arguments and expand.
47004700
Ops.append(Node->op_begin() + 2, Node->op_end());
47014701
Ops.push_back(Node->getOperand(1));
@@ -4961,7 +4961,7 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
49614961
case ISD::STRICT_FPOWI: {
49624962
RTLIB::Libcall LC = RTLIB::getPOWI(Node->getSimpleValueType(0));
49634963
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fpowi.");
4964-
if (!TLI.getLibcallName(LC)) {
4964+
if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) {
49654965
// Some targets don't have a powi libcall; use pow instead.
49664966
if (Node->isStrictFPOpcode()) {
49674967
SDValue Exponent =

llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_ExpOp(SDNode *N) {
717717
RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI(N->getValueType(0))
718718
: RTLIB::getLDEXP(N->getValueType(0));
719719
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected fpowi.");
720-
if (!TLI.getLibcallName(LC)) {
720+
if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) {
721721
// Some targets don't have a powi libcall; use pow instead.
722722
// FIXME: Implement this if some target needs it.
723723
DAG.getContext()->emitError("do not know how to soften fpowi to fpow");
@@ -802,7 +802,7 @@ bool DAGTypeLegalizer::SoftenFloatRes_UnaryWithTwoFPResults(
802802
assert(VT == N->getValueType(1) &&
803803
"expected both return values to have the same type");
804804

805-
if (!TLI.getLibcallName(LC))
805+
if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported)
806806
return false;
807807

808808
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
@@ -862,7 +862,8 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FSINCOS(SDNode *N) {
862862
RTLIB::Libcall CosLC = RTLIB::getCOS(VT);
863863

864864
SDValue SoftSin, SoftCos;
865-
if (!TLI.getLibcallName(SinLC) || !TLI.getLibcallName(CosLC)) {
865+
if (TLI.getLibcallImpl(SinLC) == RTLIB::Unsupported ||
866+
TLI.getLibcallImpl(CosLC) == RTLIB::Unsupported) {
866867
DAG.getContext()->emitError("do not know how to soften fsincos");
867868

868869
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,7 @@ SDValue DAGTypeLegalizer::PromoteIntOp_ExpOp(SDNode *N) {
26922692
RTLIB::Libcall LC = IsPowI ? RTLIB::getPOWI(N->getValueType(0))
26932693
: RTLIB::getLDEXP(N->getValueType(0));
26942694

2695-
if (LC == RTLIB::UNKNOWN_LIBCALL || !TLI.getLibcallName(LC)) {
2695+
if (TLI.getLibcallImpl(LC) == RTLIB::Unsupported) {
26962696
// Scalarize vector FPOWI instead of promoting the type. This allows the
26972697
// scalar FPOWIs to be visited and converted to libcalls before promoting
26982698
// the type.

0 commit comments

Comments
 (0)