[llvm] [NVPTX][DebugInfo] avoid emitting extra .loc directives (PR #84584)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 15 12:00:54 PDT 2024


================
@@ -489,8 +489,12 @@ void NVPTXAsmPrinter::emitFunctionEntryLabel() {
   OutStreamer->emitRawText(StringRef("{\n"));
   setAndEmitFunctionVirtualRegisters(*MF);
   // Emit initial .loc debug directive for correct relocation symbol data.
-  if (MMI && MMI->hasDebugInfo())
-    emitInitialRawDwarfLocDirective(*MF);
+  const DISubprogram *SP = MF->getFunction().getSubprogram();
+  if (SP) {
----------------
Artem-B wrote:

Nit: the temp variable can be folded into `if`:
```
if (const DISubprogram *SP = MF->getFunction().getSubprogram()) {
 ...
}
```

https://github.com/llvm/llvm-project/pull/84584


More information about the llvm-commits mailing list