================
@@ -417,6 +424,13 @@ mlir::Operation 
*CIRGenNVCUDARuntime::getKernelHandle(cir::FuncOp fn,
   globalOp->setAttr("alignment", builder.getI64IntegerAttr(
                                      cgm.getPointerAlign().getQuantity()));
 
+  // Inherit visibility and comdat from the kernel's declaration.
+  auto *fd = cast<FunctionDecl>(gd.getDecl());
+  cgm.setGVProperties(globalOp, fd);
+  FunctionTemplateDecl *ft = fd->getPrimaryTemplate();
+  if (!ft || ft->isThisDeclarationADefinition())
+    cgm.maybeSetTrivialComdat(*fd, globalOp);
----------------
steffenlarsen wrote:

At this point comdat hasn't been finalized yet, so `getComdat` would not not 
reflect it correctly. If we wanted to do it by copying through `getComdat` we 
could move it back to `emitDeviceStub`, but the current implementation is based 
off of OGCG and should result in correct comdat being produced for the handle.

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

Reply via email to