xref: /llvm-project/llvm/test/DebugInfo/X86/fission-template.ll (revision 4f320ca4ba15dcf9dda8775f74745aab7d3633a6)
1*4f320ca4SWenlei He; Check that we handle template types for split-dwarf-inlining correctly.
2*4f320ca4SWenlei He; RUN: llc -split-dwarf-file=%t.dwo -O2 < %s -dwarf-version=5 -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o -  | llvm-dwarfdump - | FileCheck %s
3*4f320ca4SWenlei He;
4*4f320ca4SWenlei He; The test case is generated from the following code
5*4f320ca4SWenlei He; clang -cc1 -emit-llvm -fdebug-info-for-profiling -fsplit-dwarf-inlining -debug-info-kind=constructor -dwarf-version=5 -split-dwarf-file temp.dwo -O2
6*4f320ca4SWenlei He;
7*4f320ca4SWenlei He; void f1();
8*4f320ca4SWenlei He;
9*4f320ca4SWenlei He; template <typename T>
10*4f320ca4SWenlei He; void f2() {
11*4f320ca4SWenlei He;   f1();
12*4f320ca4SWenlei He; }
13*4f320ca4SWenlei He;
14*4f320ca4SWenlei He; void f3() {
15*4f320ca4SWenlei He;   f2<int>();
16*4f320ca4SWenlei He; }
17*4f320ca4SWenlei He
18*4f320ca4SWenlei He; CHECK:      .debug_info contents:
19*4f320ca4SWenlei He; CHECK:        DW_TAG_skeleton_unit
20*4f320ca4SWenlei He; CHECK:          DW_TAG_subprogram
21*4f320ca4SWenlei He; CHECK-NEXT:     DW_AT_linkage_name	("_Z2f2IiEvv")
22*4f320ca4SWenlei He; CHECK-NEXT:     DW_AT_name	("f2<int>")
23*4f320ca4SWenlei He; CHECK:          DW_TAG_template_type_parameter
24*4f320ca4SWenlei He; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "int")
25*4f320ca4SWenlei He; CHECK-NEXT:       DW_AT_name	("T")
26*4f320ca4SWenlei He; CHECK:      .debug_info.dwo contents:
27*4f320ca4SWenlei He; CHECK:        DW_TAG_compile_unit
28*4f320ca4SWenlei He; CHECK:          DW_TAG_subprogram
29*4f320ca4SWenlei He; CHECK-NEXT:     DW_AT_linkage_name	("_Z2f2IiEvv")
30*4f320ca4SWenlei He; CHECK-NEXT:     DW_AT_name	("f2<int>")
31*4f320ca4SWenlei He; CHECK:          DW_TAG_template_type_parameter
32*4f320ca4SWenlei He; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "int")
33*4f320ca4SWenlei He; CHECK-NEXT:       DW_AT_name	("T")
34*4f320ca4SWenlei He
35*4f320ca4SWenlei He; ModuleID = 'split-debug-inlining-template.cpp'
36*4f320ca4SWenlei Hesource_filename = "llvm-project/clang/test/CodeGen/split-debug-inlining-template.cpp"
37*4f320ca4SWenlei Hetarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
38*4f320ca4SWenlei Hetarget triple = "x86_64-redhat-linux-gnu"
39*4f320ca4SWenlei He
40*4f320ca4SWenlei He; Function Attrs: mustprogress nounwind
41*4f320ca4SWenlei Hedefine dso_local void @_Z2f3v() local_unnamed_addr #0 !dbg !6 {
42*4f320ca4SWenlei Heentry:
43*4f320ca4SWenlei He  tail call void @_Z2f1v() #2, !dbg !11
44*4f320ca4SWenlei He  ret void, !dbg !17
45*4f320ca4SWenlei He}
46*4f320ca4SWenlei He
47*4f320ca4SWenlei Hedeclare !dbg !18 void @_Z2f1v() local_unnamed_addr #1
48*4f320ca4SWenlei He
49*4f320ca4SWenlei Heattributes #0 = { mustprogress nounwind "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
50*4f320ca4SWenlei Heattributes #1 = { "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+cx8,+mmx,+sse,+sse2,+x87" }
51*4f320ca4SWenlei Heattributes #2 = { nounwind }
52*4f320ca4SWenlei He
53*4f320ca4SWenlei He!llvm.dbg.cu = !{!0}
54*4f320ca4SWenlei He!llvm.module.flags = !{!2, !3, !4}
55*4f320ca4SWenlei He!llvm.ident = !{!5}
56*4f320ca4SWenlei He
57*4f320ca4SWenlei He!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 8b2b9c3fa91ebe583f8c634482885a669b82a1f0)", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "split-debug-inlining-template.c.tmp.dwo", emissionKind: FullDebug, debugInfoForProfiling: true, nameTableKind: None)
58*4f320ca4SWenlei He!1 = !DIFile(filename: "llvm-project/clang/test/CodeGen/<stdin>", directory: "build-debug", checksumkind: CSK_MD5, checksum: "0fb39b3bb5a60928b5d9c251b2d91b2c")
59*4f320ca4SWenlei He!2 = !{i32 7, !"Dwarf Version", i32 5}
60*4f320ca4SWenlei He!3 = !{i32 2, !"Debug Info Version", i32 3}
61*4f320ca4SWenlei He!4 = !{i32 1, !"wchar_size", i32 4}
62*4f320ca4SWenlei He!5 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git 8b2b9c3fa91ebe583f8c634482885a669b82a1f0)"}
63*4f320ca4SWenlei He!6 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !7, file: !7, line: 11, type: !8, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
64*4f320ca4SWenlei He!7 = !DIFile(filename: "llvm-project/clang/test/CodeGen/split-debug-inlining-template.cpp", directory: "", checksumkind: CSK_MD5, checksum: "0fb39b3bb5a60928b5d9c251b2d91b2c")
65*4f320ca4SWenlei He!8 = !DISubroutineType(types: !9)
66*4f320ca4SWenlei He!9 = !{null}
67*4f320ca4SWenlei He!10 = !{}
68*4f320ca4SWenlei He!11 = !DILocation(line: 8, column: 3, scope: !12, inlinedAt: !16)
69*4f320ca4SWenlei He!12 = distinct !DISubprogram(name: "f2<int>", linkageName: "_Z2f2IiEvv", scope: !7, file: !7, line: 7, type: !8, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, templateParams: !13, retainedNodes: !10)
70*4f320ca4SWenlei He!13 = !{!14}
71*4f320ca4SWenlei He!14 = !DITemplateTypeParameter(name: "T", type: !15)
72*4f320ca4SWenlei He!15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
73*4f320ca4SWenlei He!16 = distinct !DILocation(line: 12, column: 3, scope: !6)
74*4f320ca4SWenlei He!17 = !DILocation(line: 13, column: 1, scope: !6)
75*4f320ca4SWenlei He!18 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !7, file: !7, line: 4, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !10)
76