From 1ccd8756f1284e497fe921b955b8e06c8ccfbcdc Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 12 Jul 2024 15:46:51 -0500 Subject: [PATCH] [NVPTX] Disable all RTLib libcalls (#98672) Summary: This patch explicitly disables runtime calls to be emitted from the NVPTX backend. This allows other utilities to know that we do not need to worry about emitting these. --- llvm/lib/CodeGen/TargetLoweringBase.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index f36743a569739..eccac0e218c58 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -312,6 +312,13 @@ void TargetLoweringBase::InitLibcalls(const Triple &TT) { } } + // Disable most libcalls on NVPTX. + if (TT.isNVPTX()) { + for (int I = 0; I < RTLIB::UNKNOWN_LIBCALL; ++I) + if (I < RTLIB::ATOMIC_LOAD || I > RTLIB::ATOMIC_FETCH_NAND_16) + setLibcallName(static_cast(I), nullptr); + } + if (TT.isARM() || TT.isThumb()) { // These libcalls are not available in 32-bit. setLibcallName(RTLIB::SHL_I128, nullptr);