This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Avoid generating DW_TAG_GNU_call_site if no DW_TAG_GNU_call_site_parameter present
Needs RevisionPublic

Authored by alok on Apr 1 2021, 2:13 AM.

Details

Summary
There are conditions when DW_TAG_GNU_call_site is generated which has
no child of tag DW_TAG_GNU_call_site_parameter. This information does
not help and only contributes to incresed size of DWARF info.
Below is the test program.
```````````````````````````
subroutine fun (array)
  integer :: array (*)

  array(5:10) = 1311
  array(7) = 1
  array(100) = 100
  return
end subroutine

program vla
  interface
    subroutine fun (array)
      integer :: array (*)
    end subroutine
  end interface
  integer :: sub_arr(42)

  sub_arr(:) = 3
  call fun(sub_arr)
end program vla
```````````````````````````
which produces,
0x00000060:     DW_TAG_GNU_call_site
                  DW_AT_abstract_origin (0x00000088 "fun")
                  DW_AT_low_pc  (0x000000000000007a)

0x0000006d:     NULL
```````````````````````````

Diff Detail

Event Timeline

alok created this revision.Apr 1 2021, 2:13 AM
alok requested review of this revision.Apr 1 2021, 2:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2021, 2:13 AM
djtodoro requested changes to this revision.Apr 1 2021, 2:29 AM

Actually, the call_site DIE is being used for printing artificial frames for tail calls...

This revision now requires changes to proceed.Apr 1 2021, 2:29 AM
alok added a comment.Apr 1 2021, 2:31 AM

Actually, the call_site DIE is being used for printing artificial frames for tail calls...

Thanks for this info. I was not aware of it.

I think some LLDB tests would fail for sure...

I think some LLDB tests would fail for sure...

Is there LLVM test coverage for this? If not it'd be good to make sure some is added.

djtodoro added a comment.EditedApr 7 2021, 12:14 AM

I think some LLDB tests would fail for sure...

Is there LLVM test coverage for this? If not it'd be good to make sure some is added.

There are (the premerge also shows it). By applying this patch we have:

Failed Tests:
LLVM :: CodeGen/X86/xray-custom-log.ll
LLVM :: DebugInfo/AArch64/unretained-declaration-subprogram.ll
LLVM :: DebugInfo/MIR/ARM/call-site-info-vmovd.mir
LLVM :: DebugInfo/MIR/ARM/call-site-info-vmovs.mir
LLVM :: DebugInfo/MIR/Hexagon/bundled-call-pr44001.mir
LLVM :: DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
LLVM :: DebugInfo/MIR/X86/debug-call-site-param.mir
LLVM :: DebugInfo/X86/convert-loclist.ll
LLVM :: DebugInfo/X86/dbg-call-site-undef-params.ll
LLVM :: DebugInfo/X86/debug_addr.ll
LLVM :: DebugInfo/X86/dwarf-callsite-related-attrs.ll
LLVM :: DebugInfo/X86/fission-call-site.ll
LLVM :: DebugInfo/X86/lto-cross-cu-call-origin-ref.ll
LLVM :: DebugInfo/X86/ranges_always.ll
LLVM :: tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll

I think some LLDB tests would fail for sure...

Is there LLVM test coverage for this? If not it'd be good to make sure some is added.

There are (the premerge also shows it). By applying this patch we have:

Failed Tests:
LLVM :: CodeGen/X86/xray-custom-log.ll
LLVM :: DebugInfo/AArch64/unretained-declaration-subprogram.ll
LLVM :: DebugInfo/MIR/ARM/call-site-info-vmovd.mir
LLVM :: DebugInfo/MIR/ARM/call-site-info-vmovs.mir
LLVM :: DebugInfo/MIR/Hexagon/bundled-call-pr44001.mir
LLVM :: DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
LLVM :: DebugInfo/MIR/X86/debug-call-site-param.mir
LLVM :: DebugInfo/X86/convert-loclist.ll
LLVM :: DebugInfo/X86/dbg-call-site-undef-params.ll
LLVM :: DebugInfo/X86/debug_addr.ll
LLVM :: DebugInfo/X86/dwarf-callsite-related-attrs.ll
LLVM :: DebugInfo/X86/fission-call-site.ll
LLVM :: DebugInfo/X86/lto-cross-cu-call-origin-ref.ll
LLVM :: DebugInfo/X86/ranges_always.ll
LLVM :: tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll

Ah, great!