xref: /llvm-project/llvm/test/DebugInfo/COFF/fortran-contained-proc.ll (revision 8d8bb4032b7cf4151906e8bb3270c5952997a51a)
1; RUN: llc -o %t.obj %s -filetype=obj
2; RUN: llvm-pdbutil dump -symbols -types %t.obj | FileCheck %s
3;
4; The IR in this test derives from the following Fortran program
5; with inlining enabled:
6; program if_test
7;   implicit none
8;   integer, allocatable :: a
9;   allocate(a)
10;   call sub(a)
11; contains
12;   subroutine sub(aa)
13;     implicit none
14;     integer :: aa, bb
15;     bb = 1
16;     aa = bb
17;   end subroutine sub
18; end program if_test
19;
20; CHECK: [[proc_t:.*]] | LF_PROCEDURE
21;
22; CHECK: [[func_id_sub:.*]] | LF_FUNC_ID
23; CHECK-NEXT: name = SUB, type = [[proc_t]], parent scope = <no type>
24;
25; CHECK: [[func_id_if_test:.*]] | LF_FUNC_ID
26; CHECK-NEXT: name = IF_TEST, type = [[proc_t]], parent scope = <no type>
27;
28; CHECK: S_GPROC32_ID [size = {{.*}}] `IF_TEST`
29; CHECK-NEXT: parent
30; CHECK-NEXT: type = `[[func_id_if_test]] (IF_TEST)`
31;
32; ModuleID = 'tr1.f90'
33source_filename = "tr1.f90"
34target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
35target triple = "x86_64-pc-windows-msvc"
36
37@"IF_TEST$A" = internal global ptr null, align 8, !dbg !0
38@0 = internal unnamed_addr constant i32 65536
39@1 = internal unnamed_addr constant i32 2
40
41; Function Attrs: nounwind uwtable
42define void @MAIN__() local_unnamed_addr #0 !dbg !2 {
43alloca_0:
44  %func_result = tail call i32 @for_set_fpe_(ptr nonnull @0) #4, !dbg !22
45  %func_result2 = tail call i32 @for_set_reentrancy(ptr nonnull @1) #4, !dbg !22
46  %func_result4 = tail call i32 @for_alloc_allocatable(i64 4, ptr @"IF_TEST$A", i32 262144) #4, !dbg !23
47  %"IF_TEST$A_fetch.1" = load ptr, ptr @"IF_TEST$A", align 8, !dbg !24, !tbaa !25
48  call void @llvm.dbg.declare(metadata ptr %"IF_TEST$A_fetch.1", metadata !29, metadata !DIExpression()), !dbg !33
49  call void @llvm.dbg.value(metadata i32 1, metadata !32, metadata !DIExpression()), !dbg !35
50  store i32 1, ptr %"IF_TEST$A_fetch.1", align 1, !dbg !36, !tbaa !37, !alias.scope !41
51  ret void, !dbg !44
52}
53
54; Function Attrs: mustprogress nofree norecurse nosync nounwind uwtable willreturn writeonly
55define void @IF_TEST_ip_SUB(ptr noalias nocapture dereferenceable(4) %AA) local_unnamed_addr #1 !dbg !30 {
56alloca_1:
57  call void @llvm.dbg.declare(metadata ptr %AA, metadata !29, metadata !DIExpression()), !dbg !45
58  call void @llvm.dbg.value(metadata i32 1, metadata !32, metadata !DIExpression()), !dbg !46
59  store i32 1, ptr %AA, align 1, !dbg !47, !tbaa !37
60  ret void, !dbg !48
61}
62
63declare i32 @for_set_fpe_(ptr nocapture readonly) local_unnamed_addr
64
65; Function Attrs: nofree
66declare i32 @for_set_reentrancy(ptr nocapture readonly) local_unnamed_addr #2
67
68; Function Attrs: nofree
69declare i32 @for_alloc_allocatable(i64, ptr nocapture, i32) local_unnamed_addr #2
70
71; Function Attrs: mustprogress nofree nosync nounwind readnone speculatable willreturn
72declare void @llvm.dbg.declare(metadata, metadata, metadata) #3
73
74; Function Attrs: mustprogress nofree nosync nounwind readnone speculatable willreturn
75declare void @llvm.dbg.value(metadata, metadata, metadata) #3
76
77attributes #0 = { nounwind uwtable "denormal-fp-math"="preserve-sign,preserve-sign" "frame-pointer"="none" "intel-lang"="fortran" "min-legal-vector-width"="0" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" }
78attributes #1 = { mustprogress nofree norecurse nosync nounwind uwtable willreturn writeonly "denormal-fp-math"="preserve-sign,preserve-sign" "frame-pointer"="none" "intel-lang"="fortran" "min-legal-vector-width"="0" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" }
79attributes #2 = { nofree "intel-lang"="fortran" }
80attributes #3 = { mustprogress nofree nosync nounwind readnone speculatable willreturn }
81attributes #4 = { nounwind }
82
83!llvm.module.flags = !{!11, !12, !13}
84!llvm.dbg.cu = !{!6}
85!omp_offload.info = !{}
86
87!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
88!1 = distinct !DIGlobalVariable(name: "A", linkageName: "IF_TEST$A", scope: !2, file: !3, line: 11, type: !9, isLocal: true, isDefinition: true)
89!2 = distinct !DISubprogram(name: "IF_TEST", linkageName: "MAIN__", scope: !3, file: !3, line: 9, type: !4, scopeLine: 9, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !6, retainedNodes: !8)
90!3 = !DIFile(filename: "tr1.f90", directory: "d:\\iusers\\cchen15\\examples\\tests\\jr14335")
91!4 = !DISubroutineType(types: !5)
92!5 = !{null}
93!6 = distinct !DICompileUnit(language: DW_LANG_Fortran95, file: !3, producer: "Intel(R) Fortran 22.0-1087", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !7, splitDebugInlining: false, nameTableKind: None)
94!7 = !{!0}
95!8 = !{}
96!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)
97!10 = !DIBasicType(name: "INTEGER*4", size: 32, encoding: DW_ATE_signed)
98!11 = !{i32 7, !"PIC Level", i32 2}
99!12 = !{i32 2, !"Debug Info Version", i32 3}
100!13 = !{i32 2, !"CodeView", i32 1}
101!22 = !DILocation(line: 9, scope: !2)
102!23 = !DILocation(line: 12, scope: !2)
103!24 = !DILocation(line: 14, scope: !2)
104!25 = !{!26, !26, i64 0}
105!26 = !{!"ifx$unique_sym$1", !27, i64 0}
106!27 = !{!"Generic Fortran Symbol", !28, i64 0}
107!28 = !{!"ifx$root$1$MAIN__"}
108!29 = !DILocalVariable(name: "AA", arg: 1, scope: !30, file: !3, line: 17, type: !10)
109!30 = distinct !DISubprogram(name: "SUB", linkageName: "IF_TEST_ip_SUB", scope: !2, file: !3, line: 17, type: !4, scopeLine: 17, spFlags: DISPFlagDefinition, unit: !6, retainedNodes: !31)
110!31 = !{!29, !32}
111!32 = !DILocalVariable(name: "BB", scope: !30, file: !3, line: 19, type: !10)
112!33 = !DILocation(line: 17, scope: !30, inlinedAt: !34)
113!34 = distinct !DILocation(line: 14, scope: !2)
114!35 = !DILocation(line: 0, scope: !30, inlinedAt: !34)
115!36 = !DILocation(line: 21, scope: !30, inlinedAt: !34)
116!37 = !{!38, !38, i64 0}
117!38 = !{!"ifx$unique_sym$3", !39, i64 0}
118!39 = !{!"Generic Fortran Symbol", !40, i64 0}
119!40 = !{!"ifx$root$2$IF_TEST_ip_SUB"}
120!41 = !{!42}
121!42 = distinct !{!42, !43, !"IF_TEST_ip_SUB: %AA"}
122!43 = distinct !{!43, !"IF_TEST_ip_SUB"}
123!44 = !DILocation(line: 16, scope: !2)
124!45 = !DILocation(line: 17, scope: !30)
125!46 = !DILocation(line: 0, scope: !30)
126!47 = !DILocation(line: 21, scope: !30)
127!48 = !DILocation(line: 22, scope: !30)
128