[llvm] 6371a0a - [DWARF][EntryValues] Emit GNU extensions in the case of DWARF 4 + SCE

Djordje Todorovic via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 05:34:17 PDT 2020


Author: Djordje Todorovic
Date: 2020-07-24T14:33:57+02:00
New Revision: 6371a0a00edb2c56363f7d494a2fac9b6bcaee3c

URL: https://github.com/llvm/llvm-project/commit/6371a0a00edb2c56363f7d494a2fac9b6bcaee3c
DIFF: https://github.com/llvm/llvm-project/commit/6371a0a00edb2c56363f7d494a2fac9b6bcaee3c.diff

LOG: [DWARF][EntryValues] Emit GNU extensions in the case of DWARF 4 + SCE

Emit DWARF 5 call-site symbols even though DWARF 4 is set,
only in the case of LLDB tuning.

This patch addresses PR46643.

Differential Revision: https://reviews.llvm.org/D83463

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index ece6665e99f6..2de6569767f6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -990,7 +990,7 @@ void DwarfCompileUnit::constructAbstractSubprogramScopeDIE(
 }
 
 bool DwarfCompileUnit::useGNUAnalogForDwarf5Feature() const {
-  return DD->getDwarfVersion() == 4 && DD->tuneForGDB();
+  return DD->getDwarfVersion() == 4 && !DD->tuneForLLDB();
 }
 
 dwarf::Tag DwarfCompileUnit::getDwarf5OrGNUTag(dwarf::Tag Tag) const {

diff  --git a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
index fdbebd306f37..bde717e3c9da 100644
--- a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
+++ b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
@@ -1,48 +1,54 @@
-# Test the call site encoding in DWARF5 vs GNU extensions.
-#
-# === DWARF4, tune for gdb ===
+## Test the call site encoding in DWARF5 vs GNU extensions.
+
+## === DWARF4, tune for gdb ===
 # RUN: llc -emit-call-site-info -dwarf-version 4 -debugger-tune=gdb -filetype=obj \
 # RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s  \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU -implicit-check-not=DW_AT_call
-#
+
 # === DWARF5, tune for gdb ===
 # RUN: llc -dwarf-version 5 -debugger-tune=gdb -emit-call-site-info -filetype=obj \
 # RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s  \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
-#
-# === DWARF4, tune for lldb ===
+
+## === DWARF4, tune for lldb ===
 # RUN: llc -dwarf-version 4 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
 # RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s   \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
-#
-# === DWARF5, tune for lldb ===
+
+## === DWARF5, tune for lldb ===
 # RUN: llc -dwarf-version 5 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
 # RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s   \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
-#
+
+## === DWARF4, tune for sce ===
+# RUN: llc -emit-call-site-info -dwarf-version 4 -filetype=obj -debugger-tune=sce \
+# RUN:     -debug-entry-values -mtriple=x86_64-unknown-unknown \
+# RUN:     -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
+
+## === DWARF5, tune for sce ===
 # RUN: llc -emit-call-site-info -dwarf-version 5 -filetype=obj -debugger-tune=sce \
 # RUN:     -debug-entry-values -mtriple=x86_64-unknown-unknown \
 # RUN:     -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
-#
-# This is based on the following reproducer:
-#
-# extern void fn();
-# extern void fn2(int x);
-# extern int fn3();
-#
-# int fn1(int (*fn4) ()) {
-#   fn();
-#   fn2(5);
-#
-#   int x = (*fn4)();
-#   if (!x)
-#     return fn3();
-#   else
-#     return -1;
-# }
-#
-# Check GNU extensions:
-#
+
+## This is based on the following reproducer:
+##
+## extern void fn();
+## extern void fn2(int x);
+## extern int fn3();
+##
+## int fn1(int (*fn4) ()) {
+##   fn();
+##   fn2(5);
+##
+##   int x = (*fn4)();
+##   if (!x)
+##     return fn3();
+##   else
+##     return -1;
+## }
+
+## Check GNU extensions:
+
 # CHECK-GNU:        DW_TAG_subprogram
 # CHECK-GNU:          DW_AT_GNU_all_call_sites    (true)
 # CHECK-GNU:        DW_TAG_GNU_call_site
@@ -58,10 +64,9 @@
 # CHECK-GNU-NEXT:     DW_AT_abstract_origin
 # CHECK-GNU-NEXT:     DW_AT_GNU_tail_call
 # CHECK-GNU-NEXT:     DW_AT_low_pc
-#
-#
-# Check DWARF 5:
-#
+
+## Check DWARF 5:
+
 # CHECK-DWARF5:        DW_TAG_subprogram
 # CHECK-DWARF5:          DW_AT_call_all_calls    (true)
 # CHECK-DWARF5:        DW_TAG_call_site
@@ -80,7 +85,7 @@
 # CHECK-DWARF5-NEXT:     DW_AT_call_origin
 # CHECK-DWARF5-NEXT:     DW_AT_call_tail_call
 # CHECK-DWARF5-NEXT:     DW_AT_call_pc
-#
+
 --- |
   ; ModuleID = 'call-site-attrs.c'
   source_filename = "call-site-attrs.c"


        


More information about the llvm-commits mailing list