[PATCH] D89994: [libomptarget][nvptx] Undef, internal shared variables

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 23 08:43:27 PDT 2020


ABataev added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp:2858
     TransferMedium = new llvm::GlobalVariable(
-        M, Ty, /*isConstant=*/false, llvm::GlobalVariable::CommonLinkage,
-        llvm::Constant::getNullValue(Ty), TransferMediumName,
+        M, Ty, /*isConstant=*/false, llvm::GlobalVariable::InternalLinkage,
+        llvm::UndefValue::get(Ty), TransferMediumName,
----------------
jdoerfert wrote:
> ABataev wrote:
> > "Internalization" is not the best option, it increases mem pressure. Common linkage is a better choice, allows to "squash" the same objects, defined in different units. Make it arch dependable, maybe?
> > For NVPTX zero initialization is not a problem, it is resolved when PTX is generated.
> FWIW, if we do not depend on the zero initialization, we should go with undef.
> 
Sure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89994



More information about the cfe-commits mailing list