xref: /llvm-project/llvm/test/DebugInfo/MIR/ARM/call-site-info-vmovd.mir (revision 92b33822e989884d29465d34769b07d78aeb1a84)
1# RUN: llc -O1 -emit-call-site-info -filetype=obj -mtriple thumbv7em-apple-unknown-macho -start-after=machineverifier %s -o %t.o
2# RUN: llvm-dwarfdump %t.o | FileCheck %s
3
4# Crash test, reduced from:
5#
6# a(float);
7# b(double c) {
8#   d();
9#   a(c);
10# }
11#
12# Some minor surgery was performed on the MIR to remove a call to a truncating
13# cast builtin between the calls to "d" and "a", and to force d0 as the copy dst
14# and s0 as the forwarding reg.
15#
16# This was done to test the case where the copy dst (d0) is a super-reg of the
17# forwarding reg (s0).
18
19# CHECK: DW_TAG_GNU_call_site
20# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "a"
21# CHECK-NOT: call_site_parameter
22
23--- |
24  target datalayout = "e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
25  target triple = "thumbv7em-apple-unknown-macho"
26  ; Function Attrs: nounwind optsize uwtable
27  define arm_aapcs_vfpcc i32 @b(double %c) local_unnamed_addr #0 !dbg !16 {
28  entry:
29    call void @llvm.dbg.value(metadata double %c, metadata !21, metadata !DIExpression()), !dbg !22
30    %call = tail call arm_aapcs_vfpcc i32 @d(), !dbg !23
31    %conv = fptrunc double %c to float, !dbg !24
32    %call1 = tail call arm_aapcs_vfpcc i32 @a(float %conv), !dbg !25
33    ret i32 undef, !dbg !26
34  }
35  declare arm_aapcs_vfpcc i32 @d(...) local_unnamed_addr #0
36  declare !dbg !4 arm_aapcs_vfpcc i32 @a(float) local_unnamed_addr #0
37  declare void @llvm.dbg.value(metadata, metadata, metadata)
38  declare void @llvm.stackprotector(ptr, ptr)
39
40  attributes #0 = { "disable-tail-calls"="false" "frame-pointer"="all" "target-features"="+thumb-mode,+vfp2" }
41
42  !llvm.dbg.cu = !{!0}
43  !llvm.module.flags = !{!10, !11, !12, !13, !14}
44  !llvm.ident = !{!15}
45
46  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (git@github.com:apple/llvm-project.git 6203ec90d0bb0fd705fc0ad00ee263e5579aa709)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
47  !1 = !DIFile(filename: "jnyn_freeBSD.c", directory: "/Users/vsk/tmp/jnyn")
48  !2 = !{}
49  !3 = !{!4}
50  !4 = !DISubprogram(name: "a", scope: !5, file: !5, line: 1, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
51  !5 = !DIFile(filename: "unreduced2.c", directory: "/Users/vsk/tmp/jnyn")
52  !6 = !DISubroutineType(types: !7)
53  !7 = !{!8, !9}
54  !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
55  !9 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
56  !10 = !{i32 7, !"Dwarf Version", i32 4}
57  !11 = !{i32 2, !"Debug Info Version", i32 3}
58  !12 = !{i32 1, !"wchar_size", i32 4}
59  !13 = !{i32 1, !"min_enum_size", i32 4}
60  !14 = !{i32 7, !"PIC Level", i32 2}
61  !15 = !{!"clang version 10.0.0 (git@github.com:apple/llvm-project.git 6203ec90d0bb0fd705fc0ad00ee263e5579aa709)"}
62  !16 = distinct !DISubprogram(name: "b", scope: !5, file: !5, line: 2, type: !17, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)
63  !17 = !DISubroutineType(types: !18)
64  !18 = !{!8, !19}
65  !19 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
66  !20 = !{!21}
67  !21 = !DILocalVariable(name: "c", arg: 1, scope: !16, file: !5, line: 2, type: !19)
68  !22 = !DILocation(line: 0, scope: !16)
69  !23 = !DILocation(line: 3, column: 3, scope: !16)
70  !24 = !DILocation(line: 4, column: 5, scope: !16)
71  !25 = !DILocation(line: 4, column: 3, scope: !16)
72  !26 = !DILocation(line: 5, column: 1, scope: !16)
73
74...
75---
76name:            b
77callSites:
78  - { bb: 0, offset: 12, fwdArgRegs: [] }
79  - { bb: 0, offset: 15, fwdArgRegs:
80      - { arg: 0, reg: '$s0' } }
81body:             |
82  bb.0.entry:
83    liveins: $d0, $lr, $d8
84
85    DBG_VALUE $d0, $noreg, !21, !DIExpression(), debug-location !22
86    frame-setup tPUSH 14, $noreg, $r7, killed $lr, implicit-def $sp, implicit $sp
87    frame-setup CFI_INSTRUCTION def_cfa_offset 8
88    frame-setup CFI_INSTRUCTION offset $lr, -4
89    frame-setup CFI_INSTRUCTION offset $r7, -8
90    $r7 = frame-setup tMOVr $sp, 14, $noreg
91    frame-setup CFI_INSTRUCTION def_cfa_register $r7
92    $sp = frame-setup VSTMDDB_UPD $sp, 14, $noreg, killed $d8
93    frame-setup CFI_INSTRUCTION offset $d8, -16
94    $s16 = VMOVS killed $s0, 14, $noreg
95    $s17 = VMOVS killed $s1, 14, $noreg, implicit-def $d8
96    DBG_VALUE $d8, $noreg, !21, !DIExpression(), debug-location !22
97    tBL 14, $noreg, @d, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp, implicit-def dead $r0, debug-location !23
98    $d0 = VMOVD killed $d8, 14, $noreg, debug-location !24
99    DBG_VALUE $d0, $noreg, !21, !DIExpression(), debug-location !22
100    tTAILJMPd @a, 14, $noreg, implicit $sp, implicit $sp, implicit killed $s0, debug-location !25
101
102...
103