[all-commits] [llvm/llvm-project] 8c1e62: [DwarfDebug] Avoid generating extra DW_TAG_subprog...

Vladislav Dzhidzhoev via All-commits all-commits at lists.llvm.org
Fri Aug 29 06:32:22 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c1e62b6283156f3299ea4b05d5347bc09a16055
      https://github.com/llvm/llvm-project/commit/8c1e62b6283156f3299ea4b05d5347bc09a16055
  Author: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
  Date:   2025-08-29 (Fri, 29 Aug 2025)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
    M llvm/test/DebugInfo/X86/pr12831.ll

  Log Message:
  -----------
  [DwarfDebug] Avoid generating extra DW_TAG_subprogram entries (#154636)

The test llvm/test/DebugInfo/X86/pr12831.ll was added in 4d358b55fa to
fix the issue with emission of empty DW_TAG_subprogram tags
(https://bugs.llvm.org/show_bug.cgi?id=12831).

However, the test output is not checked properly, and it contains:
```
0x00000206:   DW_TAG_subprogram

0x00000207:   DW_TAG_reference_type
                DW_AT_type      (0x00000169 "class ")
```

The reason is that the DIE for the definition DISubprogram "writeExpr"
is created during the call to `getOrCreateSubprogramDIE(declaration of
writeExpr)`. Therefore, when `getOrCreateSubprogramDIE(definition of
writeExpr)` is first called, we get a recursive chain of calls:
```
getOrCreateSubprogramDIE(definition of writeExpr)
getOrCreateSubprogramDIE(declaration of writeExpr)
...
getOrCreateSubprogramDIE(definition of writeExpr)
```

The outer call doesn't expect that the DIE for the definition of
writeExpr will be created during the creation of declaration DIE. So,
another DIE is created for the same subprogram. In this PR, a check is
added to fix that.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list