[llvm] 540fd18 - DAG: Avoid using getLibcallName when looking for a divrem call (#170413)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 3 10:01:25 PST 2025
Author: Matt Arsenault
Date: 2025-12-03T13:01:21-05:00
New Revision: 540fd18568deb299a35b009d34ce32f96e3944bd
URL: https://github.com/llvm/llvm-project/commit/540fd18568deb299a35b009d34ce32f96e3944bd
DIFF: https://github.com/llvm/llvm-project/commit/540fd18568deb299a35b009d34ce32f96e3944bd.diff
LOG: DAG: Avoid using getLibcallName when looking for a divrem call (#170413)
Also introduce an error if it's not available, which is not yet
testable.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 99d14a60c6ed1..8336e1d1f4134 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -2381,8 +2381,19 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
Entry.IsZExt = !isSigned;
Args.push_back(Entry);
- SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
- TLI.getPointerTy(DAG.getDataLayout()));
+ RTLIB::LibcallImpl LibcallImpl = TLI.getLibcallImpl(LC);
+ if (LibcallImpl == RTLIB::Unsupported) {
+ DAG.getContext()->emitError(Twine("no libcall available for ") +
+ Node->getOperationName(&DAG));
+ SDValue Poison = DAG.getPOISON(RetVT);
+ Results.push_back(Poison);
+ Results.push_back(Poison);
+ return;
+ }
+
+ SDValue Callee =
+ DAG.getExternalSymbol(TLI.getLibcallImplName(LibcallImpl).data(),
+ TLI.getPointerTy(DAG.getDataLayout()));
SDLoc dl(Node);
TargetLowering::CallLoweringInfo CLI(DAG);
More information about the llvm-commits
mailing list