tra added inline comments.

================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:1017
+
+void CGNVCUDARuntime::transformManagedVars() {
+  for (auto &&Info : DeviceVars) {
----------------
A comment about how exactly we're transforming the vars would be helpful.


================
Comment at: clang/lib/CodeGen/CGCUDARuntime.h:107
+  /// Transform managed variables in device compilation.
+  virtual void transformManagedVars() = 0;
 };
----------------
Can we fold it into `makeModuleCtorFunction` ?  It does not look like something 
we would need to customize independently of other glue generating machinery.



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:463-466
+    if (Context.getLangOpts().CUDAIsDevice)
+      CUDARuntime->transformManagedVars();
+    else if (llvm::Function *CudaCtorFunction =
+                 CUDARuntime->makeModuleCtorFunction())
----------------
This does not look right. 
Was `transformManagedVars()` supposed to *replace* 
`AddGlobalCtor(CudaCtorFunction)`?

I would expect it to be in addition to the ctor we create now.

```
    if (Context.getLangOpts().CUDAIsDevice)
      CUDARuntime->transformManagedVars();
    if (llvm::Function *CudaCtorFunction =
                 CUDARuntime->makeModuleCtorFunction())
         AddGlobalCtor(CudaCtorFunction);
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96195/new/

https://reviews.llvm.org/D96195

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to