1 ; RUN: llc -emit-call-site-info %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s
3 ;; Compiled from source:
4 ;; extern int fn1 (long int x, long int y, long int z);
5 ;; __attribute__((noinline)) long int
6 ;; fn2 (long int a, long int b, long int c)
9 ;; return fn1 (5, 6, 7);
12 ;; return fn2(14, 23, 34);
15 ;; clang -g -O2 m.c -emit-llvm -S -c -o m.ll
17 ;; Verify that call site info is not created for parameters marked as "undef".
18 ; CHECK: DW_TAG_GNU_call_site
19 ; CHECK: DW_AT_abstract_origin ({{.*}} "fn2")
20 ; CHECK-NOT: DW_TAG_GNU_call_site_parameter
23 source_filename = "m.c"
24 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
25 target triple = "x86_64-unknown-linux-gnu"
27 ; Function Attrs: noinline nounwind uwtable
28 define dso_local i64 @fn2(i64 %a, i64 %b, i64 %c) local_unnamed_addr !dbg !7 {
30 call void @llvm.dbg.value(metadata i64 undef, metadata !12, metadata !DIExpression()), !dbg !16
31 call void @llvm.dbg.value(metadata i64 undef, metadata !13, metadata !DIExpression()), !dbg !16
32 call void @llvm.dbg.value(metadata i64 undef, metadata !14, metadata !DIExpression()), !dbg !16
33 call void @llvm.dbg.value(metadata i64 undef, metadata !15, metadata !DIExpression()), !dbg !16
34 %call = tail call i32 @fn1(i64 5, i64 6, i64 7) #4, !dbg !16
35 %conv = sext i32 %call to i64, !dbg !16
36 ret i64 %conv, !dbg !16
39 declare !dbg !19 dso_local i32 @fn1(i64, i64, i64) local_unnamed_addr
41 ; Function Attrs: nounwind uwtable
42 define dso_local i32 @main() local_unnamed_addr !dbg !23 {
44 %call = tail call i64 @fn2(i64 undef, i64 undef, i64 undef), !dbg !26
45 %conv = trunc i64 %call to i32, !dbg !26
46 ret i32 %conv, !dbg !26
49 ; Function Attrs: nounwind readnone speculatable willreturn
50 declare void @llvm.dbg.value(metadata, metadata, metadata)
53 !llvm.module.flags = !{!3, !4, !5}
56 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
57 !1 = !DIFile(filename: "m.c", directory: "/dir")
59 !3 = !{i32 7, !"Dwarf Version", i32 4}
60 !4 = !{i32 2, !"Debug Info Version", i32 3}
61 !5 = !{i32 1, !"wchar_size", i32 4}
62 !6 = !{!"clang version 12.0.0"}
63 !7 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 4, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
64 !8 = !DISubroutineType(types: !9)
65 !9 = !{!10, !10, !10, !10}
66 !10 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
67 !11 = !{!12, !13, !14, !15}
68 !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 4, type: !10)
69 !13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 4, type: !10)
70 !14 = !DILocalVariable(name: "c", arg: 3, scope: !7, file: !1, line: 4, type: !10)
71 !15 = !DILocalVariable(name: "q", scope: !7, file: !1, line: 6, type: !10)
72 !16 = !DILocation(line: 0, scope: !7)
73 !19 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !20, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
74 !20 = !DISubroutineType(types: !21)
75 !21 = !{!22, !10, !10, !10}
76 !22 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
77 !23 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 9, type: !24, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
78 !24 = !DISubroutineType(types: !25)
80 !26 = !DILocation(line: 10, column: 16, scope: !23)