[llvm] [NVPTX] Disable all RTLib libcalls (PR #98672)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 11:09:26 PDT 2024


https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/98672

>From 42f9b759a1b0cc4cfb88c7ae194207a507e430a1 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Fri, 12 Jul 2024 13:05:23 -0500
Subject: [PATCH] [NVPTX] Disable all RTLib libcalls

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<RTLIB::Libcall>(I), nullptr);
+  }
+
   if (TT.isARM() || TT.isThumb()) {
     // These libcalls are not available in 32-bit.
     setLibcallName(RTLIB::SHL_I128, nullptr);



More information about the llvm-commits mailing list