[PATCH] D99238: [DebugInfo] Enable the call site parameter feature by default

Alok Kumar Sharma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 23 22:25:38 PDT 2021


alok created this revision.
alok added reviewers: djtodoro, aprantl, jmorse, SouraVX, jini.susan.george, bhuvanendrakumarn.
alok added a project: debug-info.
Herald added subscribers: jansvoboda11, dexonsmith.
alok requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

This works with debug entry value feature, which works by default.
Without call site parameter feature, debug entry value feature is of no use.
With current changes, debuggers should be able to show optimized out parameters by default.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99238

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/lib/Frontend/CompilerInvocation.cpp
  llvm/include/llvm/Target/TargetOptions.h
  llvm/test/DebugInfo/X86/callsitepar-fastisel.ll


Index: llvm/test/DebugInfo/X86/callsitepar-fastisel.ll
===================================================================
--- llvm/test/DebugInfo/X86/callsitepar-fastisel.ll
+++ llvm/test/DebugInfo/X86/callsitepar-fastisel.ll
@@ -9,6 +9,17 @@
 ;CHECK: DW_AT_location (DW_OP_reg4 RSI)
 ;CHECK: DW_AT_GNU_call_site_value
 
+;; This test checks if DW_TAG_GNU_call_site_parameter is generated for option -O0
+;RUN: clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj  -main-file-name %s -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -O0 -x ir %s -o - | llvm-dwarfdump - | FileCheck %s --check-prefix=CLANG
+
+;CLANG: DW_TAG_GNU_call_site
+;CLANG: DW_AT_abstract_origin
+;CLANG-SAME: "foo"
+;CLANG: DW_AT_low_pc
+;CLANG: DW_TAG_GNU_call_site_parameter
+;CLANG: DW_AT_location (DW_OP_reg4 RSI)
+;CLANG: DW_AT_GNU_call_site_value
+
 ;;The IR is generated from below source program
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;subroutine foo (array)
Index: llvm/include/llvm/Target/TargetOptions.h
===================================================================
--- llvm/include/llvm/Target/TargetOptions.h
+++ llvm/include/llvm/Target/TargetOptions.h
@@ -302,8 +302,8 @@
     std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
 
     /// The flag enables call site info production. It is used only for debug
-    /// info, and it is restricted only to optimized code. This can be used for
-    /// something else, so that should be controlled in the frontend.
+    /// info. This can be used for something else, so that should be controlled
+    /// in the frontend.
     unsigned EmitCallSiteInfo : 1;
     /// Set if the target supports the debug entry values by default.
     unsigned SupportsDebugEntryValues : 1;
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -1642,7 +1642,7 @@
       llvm::Triple::arm, llvm::Triple::armeb, llvm::Triple::mips,
       llvm::Triple::mipsel, llvm::Triple::mips64, llvm::Triple::mips64el};
 
-  if (Opts.OptimizationLevel > 0 && Opts.hasReducedDebugInfo() &&
+  if (Opts.hasReducedDebugInfo() &&
       llvm::is_contained(DebugEntryValueArchs, T.getArch()))
     Opts.EmitCallSiteInfo = true;
 
Index: clang/include/clang/Basic/CodeGenOptions.def
===================================================================
--- clang/include/clang/Basic/CodeGenOptions.def
+++ clang/include/clang/Basic/CodeGenOptions.def
@@ -68,8 +68,7 @@
 CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
                                    ///< pass manager.
 CODEGENOPT(DisableRedZone    , 1, 0) ///< Set when -mno-red-zone is enabled.
-CODEGENOPT(EmitCallSiteInfo, 1, 0) ///< Emit call site info only in the case of
-                                   ///< '-g' + 'O>0' level.
+CODEGENOPT(EmitCallSiteInfo, 1, 0) ///< Emit call site info.
 CODEGENOPT(IndirectTlsSegRefs, 1, 0) ///< Set when -mno-tls-direct-seg-refs
                                      ///< is specified.
 CODEGENOPT(DisableTailCalls  , 1, 0) ///< Do not emit tail calls.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99238.332868.patch
Type: text/x-patch
Size: 3161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210324/5b4ef7b6/attachment.bin>


More information about the cfe-commits mailing list