xref: /llvm-project/llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll (revision 06a0ae652497513398865d9a1b0cc3f95aa82f54)
1;; This test checks processing of DIImportedEntity with elements field.
2; REQUIRES: x86_64-linux
3
4; RUN: llc %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s
5
6; CHECK: [[MYMOD:0x[0-9a-f]+]]: DW_TAG_module
7; CHECK:   DW_AT_name      ("mymod")
8; CHECK:   [[VAR1:0x[0-9a-f]+]]: DW_TAG_variable
9; CHECK:     DW_AT_name    ("var1")
10
11; CHECK: DW_TAG_subprogram
12; CHECK:   DW_AT_name      ("main")
13; CHECK:   DW_TAG_subprogram
14; CHECK:     DW_AT_name      ("use_renamed")
15; CHECK:     DW_TAG_imported_module
16; CHECK:       DW_AT_import ([[MYMOD]])
17; CHECK:       DW_TAG_imported_declaration
18; CHECK:         DW_AT_import ([[VAR1]])
19; CHECK:         DW_AT_name        ("var4")
20
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22;;This test case is generated from
23;;module mymod
24;;  integer :: var1 = 11
25;;  integer :: var2 = 12
26;;  integer :: var3 = 13
27;;end module mymod
28;;
29;;Program main
30;;  call use_renamed()
31;;  contains
32;;    subroutine use_renamed()
33;;      use mymod, var4 => var1
34;;      print *, var4
35;;    end subroutine use_renamed
36;;end program main
37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
38
39; ModuleID = 'DIImportedEntity_elements.ll'
40source_filename = "/tmp/usemodulealias.ll"
41
42%struct_mymod_8_ = type <{ [12 x i8] }>
43%struct.struct_ul_MAIN__348 = type { ptr }
44
45@_mymod_8_ = global %struct_mymod_8_ <{ [12 x i8] c"\0B\00\00\00\0C\00\00\00\0D\00\00\00" }>, align 64, !dbg !0, !dbg !7, !dbg !10
46@.C330_MAIN_ = internal constant i32 0
47@.C364_main_use_renamed = internal constant i32 25
48@.C330_main_use_renamed = internal constant i32 0
49@.C331_main_use_renamed = internal constant i64 0
50@.C359_main_use_renamed = internal constant i32 6
51@.C357_main_use_renamed = internal constant [18 x i8] c"usemodulealias.f90"
52@.C352_main_use_renamed = internal constant i32 12
53
54define i32 @mymod_() {
55.L.entry:
56  ret i32 undef
57}
58
59define void @MAIN_() !dbg !15 {
60L.entry:
61  %.S0000_353 = alloca %struct.struct_ul_MAIN__348, align 8
62  call void (ptr, ...) @fort_init(ptr @.C330_MAIN_)
63  br label %L.LB2_357
64
65L.LB2_357:                                        ; preds = %L.entry
66  call void @main_use_renamed(ptr %.S0000_353), !dbg !23
67  ret void, !dbg !24
68}
69
70define internal void @main_use_renamed(ptr noalias %.S0000) !dbg !14 {
71L.entry:
72  ret void, !dbg !25
73}
74
75declare void @fort_init(...)
76
77!llvm.module.flags = !{!21, !22}
78!llvm.dbg.cu = !{!4}
79
80!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
81!1 = distinct !DIGlobalVariable(name: "var1", scope: !2, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true)
82!2 = !DIModule(scope: !4, name: "mymod", file: !3, line: 1)
83!3 = !DIFile(filename: "DIImportedEntity_elements.f90", directory: "/tmp")
84!4 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: " F90 Flang - 1.5 2017-05-01", isOptimized: false, flags: "'+flang usemodulealias.f90 -g -S -emit-llvm'", runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, nameTableKind: None)
85!5 = !{}
86!6 = !{!0, !7, !10}
87!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_plus_uconst, 4))
88!8 = distinct !DIGlobalVariable(name: "var2", scope: !2, file: !3, line: 3, type: !9, isLocal: false, isDefinition: true)
89!9 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
90!10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression(DW_OP_plus_uconst, 8))
91!11 = distinct !DIGlobalVariable(name: "var3", scope: !2, file: !3, line: 4, type: !9, isLocal: false, isDefinition: true)
92!12 = !{!13}
93!13 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !14, entity: !2, file: !3, line: 10, elements: !19)
94!14 = distinct !DISubprogram(name: "use_renamed", scope: !15, file: !3, line: 10, type: !18, scopeLine: 10, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4, retainedNodes: !12)
95!15 = distinct !DISubprogram(name: "main", scope: !4, file: !3, line: 7, type: !16, scopeLine: 7, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !4)
96!16 = !DISubroutineType(cc: DW_CC_program, types: !17)
97!17 = !{null}
98!18 = !DISubroutineType(types: !17)
99!19 = !{!20}
100!20 = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "var4", scope: !14, entity: !1, file: !3, line: 10)
101!21 = !{i32 2, !"Dwarf Version", i32 4}
102!22 = !{i32 2, !"Debug Info Version", i32 3}
103!23 = !DILocation(line: 8, column: 1, scope: !15)
104!24 = !DILocation(line: 9, column: 1, scope: !15)
105!25 = !DILocation(line: 13, column: 1, scope: !14)
106