[llvm] fa4701e - [DWARF] Defer creating declaration DIEs until we prepare call site info
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 20 15:26:56 PST 2019
Author: Vedant Kumar
Date: 2019-12-20T15:26:31-08:00
New Revision: fa4701e1979553c2df61698ac1ac212627630442
URL: https://github.com/llvm/llvm-project/commit/fa4701e1979553c2df61698ac1ac212627630442
DIFF: https://github.com/llvm/llvm-project/commit/fa4701e1979553c2df61698ac1ac212627630442.diff
LOG: [DWARF] Defer creating declaration DIEs until we prepare call site info
It isn't necessary to create DIEs for all of the declaration subprograms
in a CU's retainedTypes list. We can defer creating these subprograms
until we need to prepare a call site tag that refers to one.
This cleanup was mentioned in passing in D70350.
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
llvm/test/DebugInfo/X86/lto-cross-cu-call-origin-ref.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index d1a36299dc4a..624e1a513ec6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -924,13 +924,6 @@ DwarfDebug::getOrCreateDwarfCompileUnit(const DICompileUnit *DIUnit) {
NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoSection());
}
- // Create DIEs for function declarations used for call site debug info.
- // Note: Declaration subprograms imported by LTO are not added to the unit's
- // list of retained types, so their DIEs are not constructed here.
- for (auto Scope : DIUnit->getRetainedTypes())
- if (auto *SP = dyn_cast_or_null<DISubprogram>(Scope))
- NewCU.getOrCreateSubprogramDIE(SP);
-
CUMap.insert({DIUnit, &NewCU});
CUDieMap.insert({&NewCU.getUnitDie(), &NewCU});
return NewCU;
diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
index 916a14022ba5..3e7e6cbfdee5 100644
--- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
+++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
@@ -159,7 +159,7 @@ body: |
...
# CHECK: DW_TAG_GNU_call_site
-# CHECK-NEXT: DW_AT_abstract_origin (0x0000002a "call_int")
+# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int")
#
# CHECK: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)
@@ -205,7 +205,7 @@ body: |
...
# CHECK: DW_TAG_GNU_call_site
-# CHECK-NEXT: DW_AT_abstract_origin (0x0000003e "call_long")
+# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_long")
#
# CHECK: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)
@@ -265,7 +265,7 @@ body: |
...
# CHECK: DW_TAG_GNU_call_site
-# CHECK-NEXT: DW_AT_abstract_origin (0x00000052 "call_int_int")
+# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int_int")
#
# CHECK: DW_TAG_GNU_call_site_parameter
# FIXME: The DW_AT_location attribute should actually refer to W0! See PR44118.
diff --git a/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir b/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
index e79be66cd4e3..caee15c2a9e6 100644
--- a/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
+++ b/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
@@ -39,17 +39,11 @@
# CHECK-GNU-NEXT: DW_AT_location (DW_OP_reg8 R8)
# CHECK-GNU-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg14 R14+3)
-# CHECK-DWARF5: [[getValue_SP:.*]]: DW_TAG_subprogram
-# CHECK-DWARF5-NEXT: DW_AT_name ("getVal")
-
-# CHECK-DWARF5: [[foo_SP:.*]]: DW_TAG_subprogram
-# CHECK-DWARF5-NEXT: DW_AT_name ("foo")
-
# CHECK-DWARF5: DW_TAG_call_site
-# CHECK-DWARF5: DW_AT_call_origin ([[getValue_SP]])
-#
+# CHECK-DWARF5: DW_AT_call_origin ([[getValue_SP:.*]])
+
# CHECK-DWARF5: DW_TAG_call_site
-# CHECK-DWARF5: DW_AT_call_origin ([[foo_SP]])
+# CHECK-DWARF5: DW_AT_call_origin ([[foo_SP:.*]])
# CHECK-DWARF5: DW_AT_call_return_pc {{.*}}
# CHECK-DWARF5-EMPTY:
# CHECK-DWARF5: DW_TAG_call_site_parameter
@@ -71,6 +65,12 @@
# CHECK-DWARF5-NEXT: DW_AT_location (DW_OP_reg8 R8)
# CHECK-DWARF5-NEXT: DW_AT_call_value (DW_OP_breg14 R14+3)
+# CHECK-DWARF5: [[getValue_SP]]: DW_TAG_subprogram
+# CHECK-DWARF5-NEXT: DW_AT_name ("getVal")
+
+# CHECK-DWARF5: [[foo_SP]]: DW_TAG_subprogram
+# CHECK-DWARF5-NEXT: DW_AT_name ("foo")
+
--- |
; ModuleID = 'test.c'
source_filename = "test.c"
diff --git a/llvm/test/DebugInfo/X86/lto-cross-cu-call-origin-ref.ll b/llvm/test/DebugInfo/X86/lto-cross-cu-call-origin-ref.ll
index db14b06fc517..00715841ab5c 100644
--- a/llvm/test/DebugInfo/X86/lto-cross-cu-call-origin-ref.ll
+++ b/llvm/test/DebugInfo/X86/lto-cross-cu-call-origin-ref.ll
@@ -49,10 +49,6 @@
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_name ("a.c")
-; CHECK: DW_TAG_subprogram
-; CHECK: DW_AT_name ("func_from_b")
-; CHECK: DW_AT_declaration (true)
-
; CHECK: 0x{{0+}}[[NOINLINE_FUNC_IN_A:.*]]: DW_TAG_subprogram
; CHECK: DW_AT_name ("noinline_func_in_a")
@@ -81,14 +77,6 @@
; CHECK: DW_TAG_compile_unit
; CHECK: DW_AT_name ("b.c")
-; CHECK: DW_TAG_subprogram
-; CHECK: DW_AT_name ("noinline_func_in_a")
-; CHECK: DW_AT_declaration (true)
-
-; CHECK: DW_TAG_subprogram
-; CHECK: DW_AT_name ("always_inline_helper_in_a_that_calls_foo")
-; CHECK: DW_AT_declaration (true)
-
; 3) Validate the cross-CU ref from "call_func_in_b_from_a" in a.c.
; CHECK: 0x{{0+}}[[FUNC_FROM_B]]: DW_TAG_subprogram
; CHECK: DW_AT_name ("func_from_b")
More information about the llvm-commits
mailing list