[clang] [clang-repl][CUDA] Move CUDA module registration to beginning of global_ctors (PR #66658)

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 01:22:12 PDT 2023


================
@@ -794,7 +794,7 @@ void CodeGenModule::Release() {
       AddGlobalCtor(ObjCInitFunction);
   if (Context.getLangOpts().CUDA && CUDARuntime) {
     if (llvm::Function *CudaCtorFunction = CUDARuntime->finalizeModule())
-      AddGlobalCtor(CudaCtorFunction);
+      AddGlobalCtor(CudaCtorFunction, /*Priority=*/0);
----------------
hahnjo wrote:

I have the same fear as @Artem-B, higher than default priorities are also sometimes reserved. We really need to see what `nvcc` does here, but what I could imagine (at least how I would solve it) is putting the constructor with the same priority before all other constructors.

https://github.com/llvm/llvm-project/pull/66658


More information about the cfe-commits mailing list