[PATCH] D51554: [CUDA][OPENMP][NVPTX]Improve logic of the debug info support.

Eric Christopher via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 5 22:39:20 PST 2018


echristo added inline comments.


================
Comment at: lib/Driver/ToolChains/Cuda.cpp:282-285
 enum DebugInfoKind {
-  NoDebug,       /// No debug info.
-  LineTableOnly, /// Line tables only.
-  FullDebug      /// Full debug info.
+  NoDebug,             /// No debug info.
+  DebugDirectivesOnly, /// Line tables only.
+  FullDebug,           /// Full debug info.
----------------
This enum doesn't appear to be complete? Either way can you make it match the other and document what each thing means a bit more?


================
Comment at: lib/Driver/ToolChains/Cuda.cpp:289
 
 static DebugInfoKind mustEmitDebugInfo(const ArgList &Args) {
+  const Arg *A = Args.getLastArg(options::OPT_O_Group);
----------------
Please document this routine in prose.


================
Comment at: lib/Driver/ToolChains/Cuda.cpp:292
+  bool IsDebugEnabled = !A || A->getOption().matches(options::OPT_O0) ||
+                        Args.hasFlag(options::OPT_cuda_noopt_device_debug,
+                                     options::OPT_no_cuda_noopt_device_debug,
----------------
ABataev wrote:
> echristo wrote:
> > Is this an nvcc compatibility flag?
> No, nvcc uses different set of flags. It uses `-g` for the debug info for the host code and `-G` for the device code. I'm not the original author of this option. clang uses it to control emission of the debug info for the device.
> The bad thing about nvcc that it disables optimizations when `-G` is used. Using this option we can use LLVM optimizations and disable the optimizations only when we call `ptxas` tool.
OK.


================
Comment at: lib/Driver/ToolChains/Cuda.cpp:706-708
+void CudaToolChain::adjustDebugInfoKind(
+    codegenoptions::DebugInfoKind &DebugInfoKind, const ArgList &Args) const {
+  switch (mustEmitDebugInfo(Args)) {
----------------
Is this really doing anything?


Repository:
  rC Clang

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

https://reviews.llvm.org/D51554





More information about the cfe-commits mailing list