Skip to content

Commit 3e32735

Browse files
authored
[DWARF] Add support for DW_GNU_call_target_clobbered (#172336)
Fixes assertion trip introduced in #172167 See https://issues.chromium.org/issues/468825583#comment2
1 parent e3c621c commit 3e32735

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,8 @@ DwarfCompileUnit::getDwarf5OrGNUAttr(dwarf::Attribute Attr) const {
12931293
return dwarf::DW_AT_GNU_all_call_sites;
12941294
case dwarf::DW_AT_call_target:
12951295
return dwarf::DW_AT_GNU_call_site_target;
1296+
case dwarf::DW_AT_call_target_clobbered:
1297+
return dwarf::DW_AT_GNU_call_site_target_clobbered;
12961298
case dwarf::DW_AT_call_origin:
12971299
return dwarf::DW_AT_abstract_origin;
12981300
case dwarf::DW_AT_call_return_pc:
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# RUN: llc %s -start-after=livedebugvalues -debugger-tune=gdb --filetype=obj -o - \
2+
# RUN: | llvm-dwarfdump - | FileCheck %s
3+
4+
# Generated from IR crash reproducer with `llc -stop-after=livedebugvalues -simplify-mir`.
5+
# Check the GNU equivalent of DW_AT_call_target_clobbered is emitted without
6+
# hitting assertions (DWARF version 4, -debugger-tune=gdb).
7+
8+
# CHECK: DW_AT_GNU_call_site_target_clobbered
9+
10+
--- |
11+
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
12+
target triple = "x86_64-unknown-linux-gnu"
13+
14+
define void @foo(ptr %p) !dbg !5 {
15+
entry:
16+
%call = tail call ptr %p(i64 0)
17+
ret void
18+
}
19+
20+
!llvm.dbg.cu = !{!0}
21+
!llvm.module.flags = !{!3, !4}
22+
23+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2, splitDebugInlining: false)
24+
!1 = !DIFile(filename: "test.cpp", directory: ".")
25+
!2 = !{}
26+
!3 = !{i32 2, !"Debug Info Version", i32 3}
27+
!4 = !{i32 7, !"Dwarf Version", i32 4}
28+
!5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !1, file: !1, line: 479, type: !6, scopeLine: 479, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2, keyInstructions: true)
29+
!6 = distinct !DISubroutineType(types: !7)
30+
!7 = !{null}
31+
...
32+
---
33+
name: foo
34+
alignment: 16
35+
tracksRegLiveness: true
36+
noPhis: true
37+
isSSA: false
38+
noVRegs: true
39+
hasFakeUses: false
40+
debugInstrRef: true
41+
tracksDebugUserValues: true
42+
liveins:
43+
- { reg: '$rdi' }
44+
frameInfo:
45+
maxAlignment: 1
46+
maxCallFrameSize: 0
47+
hasTailCall: true
48+
isCalleeSavedInfoValid: true
49+
machineFunctionInfo:
50+
amxProgModel: None
51+
body: |
52+
bb.0.entry:
53+
liveins: $rdi
54+
55+
$rax = MOV64rr $rdi
56+
dead $edi = XOR32rr undef $edi, undef $edi, implicit-def dead $eflags, implicit-def $rdi
57+
TAILJMPr64 killed renamable $rax, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit $rdi
58+
...

0 commit comments

Comments
 (0)