[clang] 03104d0 - [CIR] Narrow GPURelocatableDeviceCode NYI check to CUDA/HIP externalization (#236592)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 10:54:59 PST 2026


Author: Balaji V. Iyer.
Date: 2026-11-02T12:54:54-06:00
New Revision: 03104d0d3abf8f464012e5842f78255686d6eb45

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

LOG: [CIR] Narrow GPURelocatableDeviceCode NYI check to CUDA/HIP externalization (#236592)

The NYI check for `GPURelocatableDeviceCode` previously had a blanket
`!isSYCL() ` exclusion. This patch narrows it down to match the
condition the classic codegen uses for externalizing HIP/CUDA
device-side static file-scope variables, gated on CUDA.

Added: 
    

Modified: 
    clang/lib/CIR/CodeGen/CIRGenModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 4e11a6555b62df..11904c58f82350 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -2870,13 +2870,12 @@ static std::string getMangledNameImpl(CIRGenModule &cgm, GlobalDecl gd,
                    "getMangledName: multi-version functions");
     }
   }
-  // SYCL does not externalize file-scope statics, so RDC does not change the
-  // mangled name.
-  if (cgm.getLangOpts().GPURelocatableDeviceCode &&
-      !cgm.getLangOpts().isSYCL()) {
-    cgm.errorNYI(nd->getSourceRange(),
-                 "getMangledName: GPU relocatable device code");
-  }
+  // Make unique name for device side static file-scope variable for HIP.
+  if (cgm.getASTContext().shouldExternalize(nd) &&
+      cgm.getLangOpts().GPURelocatableDeviceCode)
+    if (cgm.getLangOpts().CUDA)
+      cgm.errorNYI(nd->getSourceRange(),
+                   "getMangledName: GPU relocatable device code");
 
   return std::string(out.str());
 }


        


More information about the cfe-commits mailing list