https://github.com/aobolensk created 
https://github.com/llvm/llvm-project/pull/216252

CC_SpirFunction is now redundant: CC_C already lowers to spir_func on 
SPIR/SPIR-V targets, after https://github.com/llvm/llvm-project/pull/210882

this also invalidates the previous CC_SpirFunction debuginfo test: 
https://github.com/llvm/llvm-project/pull/216095

>From f07d9c40a6eb18e0b8f42bdc8d21169096b72a19 Mon Sep 17 00:00:00 2001
From: Arseniy Obolenskiy <[email protected]>
Date: Fri, 14 Aug 2026 07:46:51 +0200
Subject: [PATCH] [clang][SPIR-V] Remove CC_SpirFunction calling convention

CC_SpirFunction is now redundant: CC_C already lowers to spir_func on 
SPIR/SPIR-V targets, after https://github.com/llvm/llvm-project/pull/210882

this also invalidates the previous CC_SpirFunction debuginfo test: 
https://github.com/llvm/llvm-project/pull/216095
---
 clang/include/clang/Basic/Specifiers.h | 2 --
 clang/lib/AST/ItaniumMangle.cpp        | 1 -
 clang/lib/AST/Type.cpp                 | 2 --
 clang/lib/AST/TypePrinter.cpp          | 3 ---
 clang/lib/Basic/Targets/SPIR.h         | 4 +---
 clang/lib/CodeGen/CGCall.cpp           | 2 --
 clang/lib/CodeGen/CGDebugInfo.cpp      | 2 --
 clang/lib/CodeGen/Targets/SPIR.cpp     | 2 +-
 clang/test/DebugInfo/Generic/cc.c      | 1 -
 clang/tools/libclang/CXType.cpp        | 1 -
 10 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/clang/include/clang/Basic/Specifiers.h 
b/clang/include/clang/Basic/Specifiers.h
index 81b228f5054f8..a35f1cfd5f9d6 100644
--- a/clang/include/clang/Basic/Specifiers.h
+++ b/clang/include/clang/Basic/Specifiers.h
@@ -289,7 +289,6 @@ namespace clang {
     CC_AAPCS,             // __attribute__((pcs("aapcs")))
     CC_AAPCS_VFP,         // __attribute__((pcs("aapcs-vfp")))
     CC_IntelOclBicc,      // __attribute__((intel_ocl_bicc))
-    CC_SpirFunction,      // not assigned at the AST level, codegen-only on 
SPIR
     CC_DeviceKernel,      // __attribute__((device_kernel))
     CC_Swift,             // __attribute__((swiftcall))
     CC_SwiftAsync,        // __attribute__((swiftasynccall))
@@ -325,7 +324,6 @@ namespace clang {
     case CC_X86RegCall:
     case CC_X86Pascal:
     case CC_X86VectorCall:
-    case CC_SpirFunction:
     case CC_DeviceKernel:
     case CC_Swift:
     case CC_SwiftAsync:
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index f6c4ca1ae6ba8..da8339e4a45ee 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -3546,7 +3546,6 @@ StringRef 
CXXNameMangler::getCallingConvQualifierName(CallingConv CC) {
   case CC_AArch64VectorCall:
   case CC_AArch64SVEPCS:
   case CC_IntelOclBicc:
-  case CC_SpirFunction:
   case CC_DeviceKernel:
   case CC_PreserveMost:
   case CC_PreserveAll:
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 5069b587c1f8b..4063d03f7750e 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3765,8 +3765,6 @@ StringRef FunctionType::getNameForCallConv(CallingConv 
CC) {
     return "aarch64_sve_pcs";
   case CC_IntelOclBicc:
     return "intel_ocl_bicc";
-  case CC_SpirFunction:
-    return "spir_function";
   case CC_DeviceKernel:
     return "device_kernel";
   case CC_Swift:
diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp
index 20dd450d5d63f..bb3aa2bd22e77 100644
--- a/clang/lib/AST/TypePrinter.cpp
+++ b/clang/lib/AST/TypePrinter.cpp
@@ -1181,9 +1181,6 @@ void TypePrinter::printFunctionAfter(const 
FunctionType::ExtInfo &Info,
     case CC_X86RegCall:
       OS << " __attribute__((regcall))";
       break;
-    case CC_SpirFunction:
-      // Do nothing. These CCs are not available as attributes.
-      break;
     case CC_Swift:
       OS << " __attribute__((swiftcall))";
       break;
diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
index 00d766ffea113..48a3d9e481f0e 100644
--- a/clang/lib/Basic/Targets/SPIR.h
+++ b/clang/lib/Basic/Targets/SPIR.h
@@ -183,9 +183,7 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public 
TargetInfo {
   }
 
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override 
{
-    return (CC == CC_C || CC == CC_SpirFunction || CC == CC_DeviceKernel)
-               ? CCCR_OK
-               : CCCR_Warning;
+    return (CC == CC_C || CC == CC_DeviceKernel) ? CCCR_OK : CCCR_Warning;
   }
 
   void setAddressSpaceMap(bool DefaultIsGeneric) {
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index d0e0a55e78ced..0894bda19a4b3 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -94,8 +94,6 @@ unsigned 
CodeGenTypes::ClangCallConvToLLVMCallConv(CallingConv CC) {
     return llvm::CallingConv::AArch64_VectorCall;
   case CC_AArch64SVEPCS:
     return llvm::CallingConv::AArch64_SVE_VectorCall;
-  case CC_SpirFunction:
-    return llvm::CallingConv::SPIR_FUNC;
   case CC_DeviceKernel:
     return CGM.getTargetCodeGenInfo().getDeviceKernelCallingConv();
   case CC_PreserveMost:
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp 
b/clang/lib/CodeGen/CGDebugInfo.cpp
index 27db6a3110695..37ee3765fd7c4 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1825,8 +1825,6 @@ static unsigned getDwarfCC(CallingConv CC, const 
llvm::Triple &T) {
     return llvm::dwarf::DW_CC_LLVM_AAPCS_VFP;
   case CC_IntelOclBicc:
     return llvm::dwarf::DW_CC_LLVM_IntelOclBicc;
-  case CC_SpirFunction:
-    return llvm::dwarf::DW_CC_LLVM_SpirFunction;
   case CC_DeviceKernel:
     return llvm::dwarf::DW_CC_LLVM_DeviceKernel;
   case CC_Swift:
diff --git a/clang/lib/CodeGen/Targets/SPIR.cpp 
b/clang/lib/CodeGen/Targets/SPIR.cpp
index 177d166d5b85b..3cb0a10f9a4fd 100644
--- a/clang/lib/CodeGen/Targets/SPIR.cpp
+++ b/clang/lib/CodeGen/Targets/SPIR.cpp
@@ -465,7 +465,7 @@ void SPIRVTargetCodeGenInfo::setCUDAKernelCallingConvention(
 void CommonSPIRTargetCodeGenInfo::setOCLKernelStubCallingConvention(
     const FunctionType *&FT) const {
   FT = getABIInfo().getContext().adjustFunctionType(
-      FT, FT->getExtInfo().withCallingConv(CC_SpirFunction));
+      FT, FT->getExtInfo().withCallingConv(CC_C));
 }
 
 // LLVM currently assumes a null pointer has the bit pattern 0, but some GPU
diff --git a/clang/test/DebugInfo/Generic/cc.c 
b/clang/test/DebugInfo/Generic/cc.c
index e430e4c8ed87b..fc75c08e46a63 100644
--- a/clang/test/DebugInfo/Generic/cc.c
+++ b/clang/test/DebugInfo/Generic/cc.c
@@ -18,7 +18,6 @@
 //    CC_AAPCS,       // __attribute__((pcs("aapcs")))
 //    CC_AAPCS_VFP,   // __attribute__((pcs("aapcs-vfp")))
 //    CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
-//    CC_SpirFunction, // default for OpenCL functions on SPIR target
 //    CC_OpenCLKernel, // inferred for OpenCL kernels
 //    CC_Swift,        // __attribute__((swiftcall))
 //    CC_SwiftAsync,   // __attribute__((swiftasynccall))
diff --git a/clang/tools/libclang/CXType.cpp b/clang/tools/libclang/CXType.cpp
index 0063939dec423..912ce10afc251 100644
--- a/clang/tools/libclang/CXType.cpp
+++ b/clang/tools/libclang/CXType.cpp
@@ -730,7 +730,6 @@ CXCallingConv clang_getFunctionTypeCallingConv(CXType X) {
       TCALLINGCONV(RISCVVLSCall_16384);
       TCALLINGCONV(RISCVVLSCall_32768);
       TCALLINGCONV(RISCVVLSCall_65536);
-    case CC_SpirFunction: return CXCallingConv_Unexposed;
     case CC_DeviceKernel:
       return CXCallingConv_Unexposed;
       break;

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to