1# RUN: llc -mtriple mips64-linux -emit-call-site-info -start-after=livedebugvalues -filetype=obj %s -o -| llvm-dwarfdump -| FileCheck %s 2 3## Test case where a parameter value could be described as a sub-register. 4## Built from source: 5## extern int foo(char*,int,int); 6## int f1(int a, char* str){ 7## return foo(str, a, 0); 8## } 9## fastcc attribute of foo() is added manually to the .ll to match the real case 10 11#CHECK: DW_TAG_GNU_call_site 12#CHECK-NEXT: DW_AT_abstract_origin {{.*}} "foo" 13 14#CHECK: DW_TAG_GNU_call_site_parameter 15#CHECK-NEXT: DW_AT_location (DW_OP_reg6 A2_64) 16#CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_lit0) 17#CHECK-EMPTY: 18#CHECK-NEXT: DW_TAG_GNU_call_site_parameter 19#CHECK-NEXT: DW_AT_location (DW_OP_reg4 A0_64) 20#CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg5 A1_64)) 21#CHECK-EMPTY: 22## The parameter, which value is loaded by COPY instr using sub-register, should be omitted. 23#CHECK-NOT: DW_TAG_GNU_call_site_parameter 24#CHECK-NOT: DW_AT_location (DW_OP_reg5 A1_64) 25#CHECK-NOT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg4 A0_64)) 26--- | 27 ; ModuleID = 'm.ll' 28 source_filename = "m.c" 29 target datalayout = "E-m:e-i8:8:32-i16:16:32-i64:64-n32:64-S128" 30 target triple = "mips64-unknown-linux" 31 32 ; Function Attrs: nounwind 33 define signext i32 @f1(i32 signext %a, ptr %str) local_unnamed_addr !dbg !8 { 34 entry: 35 call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !18 36 call void @llvm.dbg.value(metadata ptr %str, metadata !17, metadata !DIExpression()), !dbg !18 37 %call = tail call fastcc signext i32 @foo(ptr %str, i32 signext %a, i32 signext 0), !dbg !18 38 ret i32 %call, !dbg !18 39 } 40 41 declare !dbg !21 fastcc signext i32 @foo(ptr, i32 signext, i32 signext) local_unnamed_addr 42 43 ; Function Attrs: nounwind readnone speculatable willreturn 44 declare void @llvm.dbg.value(metadata, metadata, metadata) 45 46 !llvm.dbg.cu = !{!0} 47 !llvm.module.flags = !{!3, !4, !5, !6} 48 !llvm.ident = !{!7} 49 50 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) 51 !1 = !DIFile(filename: "<stdin>", directory: "/dir") 52 !2 = !{} 53 !3 = !{i32 7, !"Dwarf Version", i32 4} 54 !4 = !{i32 2, !"Debug Info Version", i32 3} 55 !5 = !{i32 1, !"wchar_size", i32 4} 56 !6 = !{i32 7, !"PIC Level", i32 1} 57 !7 = !{!"clang version 11.0.0"} 58 !8 = distinct !DISubprogram(name: "f1", scope: !9, file: !9, line: 4, type: !10, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15) 59 !9 = !DIFile(filename: "m.c", directory: "/dir") 60 !10 = !DISubroutineType(types: !11) 61 !11 = !{!12, !12, !13} 62 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 63 !13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64) 64 !14 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 65 !15 = !{!16, !17} 66 !16 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !9, line: 4, type: !12) 67 !17 = !DILocalVariable(name: "str", arg: 2, scope: !8, file: !9, line: 4, type: !13) 68 !18 = !DILocation(line: 0, scope: !8) 69 !21 = !DISubprogram(name: "foo", scope: !9, file: !9, line: 2, type: !22, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 70 !22 = !DISubroutineType(types: !23) 71 !23 = !{!12, !13, !12, !12} 72 73... 74--- 75name: f1 76alignment: 8 77stack: 78 - { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8, 79 stack-id: default, callee-saved-register: '$ra_64', callee-saved-restored: true, 80 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 81callSites: 82 - { bb: 0, offset: 12, fwdArgRegs: 83 - { arg: 0, reg: '$a0_64' } 84 - { arg: 1, reg: '$a1' } 85 - { arg: 2, reg: '$a2' } } 86body: | 87 bb.0.entry: 88 DBG_VALUE $a0_64, $noreg, !16, !DIExpression(), debug-location !18 89 DBG_VALUE $a1_64, $noreg, !17, !DIExpression(), debug-location !18 90 $sp_64 = DADDiu $sp_64, -16 91 CFI_INSTRUCTION def_cfa_offset 16 92 SD killed $ra_64, $sp_64, 8 :: (store (s64) into %stack.0) 93 CFI_INSTRUCTION offset $ra_64, -8 94 $at_64 = OR64 $a0_64, $zero_64 95 DBG_VALUE $a1_64, $noreg, !17, !DIExpression(), debug-location !18 96 DBG_VALUE $at_64, $noreg, !16, !DIExpression(), debug-location !18 97 $a0_64 = OR64 killed $a1_64, $zero_64, debug-location !18 98 DBG_VALUE $a0_64, $noreg, !17, !DIExpression(), debug-location !18 99 $a1 = OR $at, $zero, implicit killed $at_64, debug-location !18 100 JAL @foo, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $a1, implicit killed $a2, implicit-def $sp, implicit-def $v0, debug-location !18 { 101 $a2 = ADDiu $zero, 0, debug-location !18 102 } 103 renamable $v0_64 = SLL64_32 killed renamable $v0, debug-location !18 104 $ra_64 = LD $sp_64, 8, debug-location !18 :: (load (s64) from %stack.0) 105 PseudoReturn64 undef $ra_64, implicit $v0_64, debug-location !18 { 106 $sp_64 = DADDiu $sp_64, 16 107 } 108 109... 110