tra added inline comments.

Comment at: lib/CodeGen/CGCUDANV.cpp:281
+  // get name from the module to generate unique ctor name for every module
+  SmallString<128> ModuleName
rjmccall wrote:
> Please explain in the comment *why* you're doing this.  It's just for 
> debugging, right?  So that it's known which object file the constructor 
> function comes from.
I'm also interested in in the motivation for this change.

Also, if the goal is to have an unique module identifier, would compiling two 
different files with the same name be a problem? If the goal is to help 
identifying a module, this may be OK, if not ideal. If you really need to have 
unique name, then you may need to do something more elaborate. NVCC appears to 
use some random number (or hash of something?) for that.

Comment at: lib/CodeGen/CGCUDANV.cpp:289
       llvm::FunctionType::get(VoidTy, VoidPtrTy, false),
-      llvm::GlobalValue::InternalLinkage, "__cuda_module_ctor", &TheModule);
+      llvm::GlobalValue::InternalLinkage, "__cuda_module_ctor-" + ModuleName,
+      &TheModule);
I'd rather not use '-' in a symbol. It's likely to end up being escaped in some 
way. '_' is a safer bet.

Comment at: unittests/CodeGen/IncrementalProcessingTest.cpp:176-178
+// In CUDA incremental processing, a CUDA ctor or dtor will be generated for 
+// every statement if a fatbinary file exists.
I don't understand the comment. What is 'CUDA incremental processing' and what 
exactly is meant by 'statement' here? I'd appreciate if you could give me more 
details. My understanding is that ctor/dtor are generated once per TU. I 
suspect "incremental processing" may change that, but I have no idea what 
exactly does it do.

  rC Clang

cfe-commits mailing list

Reply via email to