[PATCH] D16739: [CUDA] Die if we ask the NVPTX backend to emit a global ctor/dtor.

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 16:32:19 PST 2016


tra accepted this revision.
tra added a comment.

LGTM.


================
Comment at: lib/Target/NVPTX/NVPTXAsmPrinter.cpp:808
@@ +807,3 @@
+  const ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer());
+  if (!InitList) return true;  // Not an array; we don't know how to parse.
+  return InitList->getNumOperands() == 0;
----------------
jlebar wrote:
> tra wrote:
> > I'd make it an assert so we know if/when llvm.global_ctors mutates into something we can't deal with.
> That was my inclination as well, but in AsmPrinter, this is not an error, so I'm not sure it should be one here.
> 
> https://github.com/llvm-project/llvm-project/blob/49e3b4837314fc2920616c36287aa23e4e4be6fc/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L1568
OK. We'll probably catch it when we generate something ptxas can't handle.


http://reviews.llvm.org/D16739





More information about the llvm-commits mailing list