Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,13 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(const DISubprogram *SP, bool Minimal) {
ContextDIE = &getUnitDie();
// Build the decl now to ensure it precedes the definition.
getOrCreateSubprogramDIE(SPDecl);
// Check whether the DIE for SP has already been created after the call
// above.
// FIXME: Should the creation of definition subprogram DIE during
// the creation of declaration subprogram DIE be allowed?
// See https://github.com/llvm/llvm-project/pull/154636.
if (DIE *SPDie = getDIE(SP))
return SPDie;
}
}

Expand Down
37 changes: 36 additions & 1 deletion llvm/test/DebugInfo/X86/pr12831.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -o /dev/null
; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s

; Check that there are no empty DW_TAG_subprogram tags.
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT
; CHECK-NOT: DW_TAG_subprogram

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down