Page MenuHomePhabricator

[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

Unit TestsFailed

TimeTest
80 msx64 debian > LLVM.CodeGen/X86::xray-custom-log.ll
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc -verify-machineinstrs -mtriple=x86_64 < /mnt/disks/ssd0/agent/llvm-project/llvm/test/CodeGen/X86/xray-custom-log.ll | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/CodeGen/X86/xray-custom-log.ll
60 msx64 debian > LLVM.DebugInfo/AArch64::unretained-declaration-subprogram.ll
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc -mtriple=arm64-apple-ios -filetype=obj < /mnt/disks/ssd0/agent/llvm-project/llvm/test/DebugInfo/AArch64/unretained-declaration-subprogram.ll -o /mnt/disks/ssd0/agent/llvm-project/build/test/DebugInfo/AArch64/Output/unretained-declaration-subprogram.ll.tmp.o
50 msx64 debian > LLVM.DebugInfo/MIR/ARM::call-site-info-vmovd.mir
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc -O1 -emit-call-site-info -filetype=obj -mtriple thumbv7em-apple-unknown-macho -start-after=machineverifier /mnt/disks/ssd0/agent/llvm-project/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovd.mir -o /mnt/disks/ssd0/agent/llvm-project/build/test/DebugInfo/MIR/ARM/Output/call-site-info-vmovd.mir.tmp.o
50 msx64 debian > LLVM.DebugInfo/MIR/ARM::call-site-info-vmovs.mir
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc -O1 -emit-call-site-info -filetype=obj -mtriple thumbv7em-apple-unknown-macho -start-after=machineverifier /mnt/disks/ssd0/agent/llvm-project/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovs.mir -o /mnt/disks/ssd0/agent/llvm-project/build/test/DebugInfo/MIR/ARM/Output/call-site-info-vmovs.mir.tmp.o
60 msx64 debian > LLVM.DebugInfo/MIR/Hexagon::bundled-call-pr44001.mir
Script: -- : 'RUN: at line 1'; /mnt/disks/ssd0/agent/llvm-project/build/bin/llc -filetype=obj -start-after=patchable-function -O3 /mnt/disks/ssd0/agent/llvm-project/llvm/test/DebugInfo/MIR/Hexagon/bundled-call-pr44001.mir -o - | /mnt/disks/ssd0/agent/llvm-project/build/bin/llvm-dwarfdump -v - | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/DebugInfo/MIR/Hexagon/bundled-call-pr44001.mir
View Full Test Results (29 Failed)

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!