[PATCH] D121299: [NVPTX] Disable DWARF .file directory for PTX

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 11:53:47 PST 2022


tra added a comment.

In D121299#3370530 <https://reviews.llvm.org/D121299#3370530>, @MaskRay wrote:

> Can you list the clang and ptxas commands to be clearer?

I do not think ptxas gets any special command line options. Debug info format affects the generated PTX outout only.

> Also, should the change be in clang/lib/Driver? There are existing settings for CUDA.
> It's also worth adding comments like "As of <date>/<version>, ptxas does not support ..." so that others can revisit the opt-out in the future.

We already clamp DWARF version for targets that don't support newer ones. 
If split directory/file arguments for `.file` directive are properties of DWARF5 (AFAICT, they are: https://sourceware.org/binutils/docs/as/File.html) , then not generating this format for older versions looks sensible to me. It does not have anything to do with CUDA itself. 
The question is whether this is the right place to do it, or would it better to do it wherever `UseDwarfDirectory` is set.



================
Comment at: llvm/lib/MC/MCAsmStreamer.cpp:1557-1559
+  bool UseDwarfDir = UseDwarfDirectory;
+  if (getContext().getDwarfVersion() < 5 && !MAI->useIntegratedAssembler())
+    UseDwarfDir = false;
----------------
Nit. It may be more readable to rephrase it as:
```
bool DwarfDirIsSupported = getContext().getDwarfVersion() >= 5 || MAI->useIntegratedAssembler();

printDwarfFileDirective(FileNo, Directory, Filename, Checksum, Source,
                          UseDwarfDirectory && DwarfDirIsSupported, OS1);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121299



More information about the llvm-commits mailing list