• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -mtriple aarch64-linux-gnu -emit-call-site-info -debug-entry-values -start-after=livedebugvalues -filetype=obj -o - %s \
2# RUN:     | llvm-dwarfdump - | FileCheck %s --implicit-check-not=DW_TAG_GNU_call_site_parameter
3#
4# Based on the following C reproducer:
5#
6# extern void call(long, long, long);
7#
8# void entry_value (long param) {
9#   call(param + 222, param - 444, param);
10# }
11
12--- |
13  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
14  target triple = "aarch64"
15
16  define dso_local void @entry_value(i64 %param) local_unnamed_addr !dbg !12 {
17  entry:
18    call void @llvm.dbg.value(metadata i64 %param, metadata !16, metadata !DIExpression()), !dbg !17
19    %add = add nsw i64 %param, 222, !dbg !17
20    %sub = add nsw i64 %param, -444, !dbg !17
21    call void @call(i64 %add, i64 %sub, i64 %param), !dbg !17
22    ret void, !dbg !17
23  }
24
25  declare !dbg !4 dso_local void @call(i64, i64, i64) local_unnamed_addr
26
27  declare void @llvm.dbg.value(metadata, metadata, metadata)
28
29  !llvm.dbg.cu = !{!0}
30  !llvm.module.flags = !{!8, !9, !10}
31  !llvm.ident = !{!11}
32
33  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
34  !1 = !DIFile(filename: "dbgcall-site-expr-entry-value.mir", directory: "/")
35  !2 = !{}
36  !3 = !{!4}
37  !4 = !DISubprogram(name: "call", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
38  !5 = !DISubroutineType(types: !6)
39  !6 = !{null, !7, !7, !7}
40  !7 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
41  !8 = !{i32 7, !"Dwarf Version", i32 4}
42  !9 = !{i32 2, !"Debug Info Version", i32 3}
43  !10 = !{i32 1, !"wchar_size", i32 4}
44  !11 = !{!"clang version 11.0.0 "}
45  !12 = distinct !DISubprogram(name: "entry_value", scope: !1, file: !1, line: 3, type: !13, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
46  !13 = !DISubroutineType(types: !14)
47  !14 = !{null, !7}
48  !15 = !{!16}
49  !16 = !DILocalVariable(name: "param", arg: 1, scope: !12, file: !1, line: 3, type: !7)
50  !17 = !DILocation(line: 4, scope: !12)
51
52...
53---
54name:            entry_value
55tracksRegLiveness: true
56stack:
57  - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' }
58  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' }
59callSites:
60  - { bb: 0, offset: 10, fwdArgRegs:
61      - { arg: 0, reg: '$x0' }
62      - { arg: 1, reg: '$x1' }
63      - { arg: 2, reg: '$x2' } }
64body:             |
65  bb.0.entry:
66    liveins: $x0, $lr
67
68    DBG_VALUE $x0, $noreg, !16, !DIExpression(), debug-location !17
69    early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store 8 into %stack.1), (store 8 into %stack.0)
70    $fp = frame-setup ADDXri $sp, 0, 0
71    frame-setup CFI_INSTRUCTION def_cfa $w29, 16
72    frame-setup CFI_INSTRUCTION offset $w30, -8
73    frame-setup CFI_INSTRUCTION offset $w29, -16
74    $x2 = ORRXrs $xzr, $x0, 0
75    DBG_VALUE $x2, $noreg, !16, !DIExpression(), debug-location !17
76    renamable $x0 = nsw ADDXri killed $x0, 222, 0, debug-location !17
77    renamable $x1 = nsw SUBXri renamable $x2, 444, 0, debug-location !17
78    BL @call, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit killed $x1, implicit killed $x2, implicit-def $sp, debug-location !17
79    early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2, debug-location !17 :: (load 8 from %stack.1), (load 8 from %stack.0)
80    RET undef $lr, debug-location !17
81
82...
83
84# Verify that a call site parameter is emitted for the third parameter. There
85# should also be entries for the first and second parameter, but
86# DW_OP_LLVM_entry_value operations can currently not be emitted together with
87# any other expressions. Verify that nothing is emitted rather than an assert
88# being triggered, or broken expressions being emitted.
89
90# CHECK: DW_TAG_GNU_call_site_parameter
91# CHECK-NEXT: DW_AT_location      (DW_OP_reg2 W2)
92# CHECK-NEXT: DW_AT_GNU_call_site_value   (DW_OP_GNU_entry_value(DW_OP_reg0 W0))
93