[llvm] b2eb7b0 - SPIRV: Define runtime libcalls to be (almost) empty (#148631)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 02:51:12 PDT 2025


Author: Matt Arsenault
Date: 2025-07-15T18:51:09+09:00
New Revision: b2eb7b070115cd6c17b9d1d164d52ac5e0d16b14

URL: https://github.com/llvm/llvm-project/commit/b2eb7b070115cd6c17b9d1d164d52ac5e0d16b14
DIFF: https://github.com/llvm/llvm-project/commit/b2eb7b070115cd6c17b9d1d164d52ac5e0d16b14.diff

LOG: SPIRV: Define runtime libcalls to be (almost) empty (#148631)

This is a behavior change; previously SPIRV inherited
a default set of calls which seems like a mistake. This
defines a library set with no calls. Add memcpy and memset
as a hack; this avoids PreISelIntrinsicLowering performing
the default expansion. SPIRVPrepareFunctions also calls
the utilities to expand these but the resulting output
is slightly different. The backend specific version
can probably be removed, it for some reason has a larger
output than the default one.

Added: 
    

Modified: 
    llvm/include/llvm/IR/RuntimeLibcalls.td

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index d4d982922ad9b..989e2e7e7631a 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -2054,6 +2054,17 @@ def SPARCSystemLibrary
        LibmHasSinCosF32, LibmHasSinCosF64, LibmHasSinCosF128)
 >;
 
+//===----------------------------------------------------------------------===//
+// SPIRV Runtime Libcalls
+//===----------------------------------------------------------------------===//
+
+def isSPIRV : RuntimeLibcallPredicate<"TT.isSPIRV()">;
+
+// No calls FIXME: Add memcpy/memset is a hack to skip
+// PreISelIntrinsicLowering in favor of SPIRVPrepareFunctions;
+// probably should remove that and just use the default one.
+def SPIRVSystemLibrary : SystemRuntimeLibrary<isSPIRV, (add memset, memcpy)>;
+
 //===----------------------------------------------------------------------===//
 // Windows Runtime Libcalls
 //===----------------------------------------------------------------------===//


        


More information about the llvm-commits mailing list