xref: /llvm-project/llvm/test/Bitcode/DIImportedEntity_elements.ll (revision a5b72abc9eaadbd319f0fbb8ae947d2dd289b30a)
1;; This test checks processing of DIImportedEntity with elements field.
2; REQUIRES: x86_64-linux
3
4; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
5
6; CHECK: !DIImportedEntity(tag: DW_TAG_imported_module
7; CHECK-SAME: elements: [[ELEMENTS:![0-9]+]]
8; CHECK: [[ELEMENTS]] = !{[[ELEMENT:![0-9]+]]}
9; CHECK: [[ELEMENT]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "var4"
10
11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12;;This test case is generated from
13;;module mymod
14;;  integer :: var1 = 11
15;;  integer :: var2 = 12
16;;  integer :: var3 = 13
17;;end module mymod
18;;
19;;Program main
20;;  call use_renamed()
21;;  contains
22;;    subroutine use_renamed()
23;;      use mymod, var4 => var1
24;;      print *, var4
25;;    end subroutine use_renamed
26;;end program main
27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28
29; ModuleID = 'DIImportedEntity_elements.ll'
30source_filename = "/tmp/usemodulealias.ll"
31
32%struct_mymod_8_ = type <{ [12 x i8] }>
33%struct.struct_ul_MAIN__348 = type { i8* }
34
35@_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
36@.C330_MAIN_ = internal constant i32 0
37@.C364_main_use_renamed = internal constant i32 25
38@.C330_main_use_renamed = internal constant i32 0
39@.C331_main_use_renamed = internal constant i64 0
40@.C359_main_use_renamed = internal constant i32 6
41@.C357_main_use_renamed = internal constant [18 x i8] c"usemodulealias.f90"
42@.C352_main_use_renamed = internal constant i32 12
43
44define i32 @mymod_() {
45.L.entry:
46  ret i32 undef
47}
48
49define void @MAIN_() !dbg !15 {
50L.entry:
51  %.S0000_353 = alloca %struct.struct_ul_MAIN__348, align 8
52  %0 = bitcast i32* @.C330_MAIN_ to i8*
53  %1 = bitcast void (...)* @fort_init to void (i8*, ...)*
54  call void (i8*, ...) %1(i8* %0)
55  br label %L.LB2_357
56
57L.LB2_357:                                        ; preds = %L.entry
58  %2 = bitcast %struct.struct_ul_MAIN__348* %.S0000_353 to i64*, !dbg !23
59  call void @main_use_renamed(i64* %2), !dbg !23
60  ret void, !dbg !24
61}
62
63define internal void @main_use_renamed(i64* noalias %.S0000) !dbg !14 {
64L.entry:
65  ret void, !dbg !25
66}
67
68declare void @fort_init(...)
69
70!llvm.module.flags = !{!21, !22}
71!llvm.dbg.cu = !{!4}
72
73!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
74!1 = distinct !DIGlobalVariable(name: "var1", scope: !2, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true)
75!2 = !DIModule(scope: !4, name: "mymod", file: !3, line: 1)
76!3 = !DIFile(filename: "DIImportedEntity_elements.f90", directory: "/tmp")
77!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, imports: !12, nameTableKind: None)
78!5 = !{}
79!6 = !{!0, !7, !10}
80!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_plus_uconst, 4))
81!8 = distinct !DIGlobalVariable(name: "var2", scope: !2, file: !3, line: 3, type: !9, isLocal: false, isDefinition: true)
82!9 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
83!10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression(DW_OP_plus_uconst, 8))
84!11 = distinct !DIGlobalVariable(name: "var3", scope: !2, file: !3, line: 4, type: !9, isLocal: false, isDefinition: true)
85!12 = !{!13}
86!13 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !14, entity: !2, file: !3, line: 10, elements: !19)
87!14 = distinct !DISubprogram(name: "use_renamed", scope: !15, file: !3, line: 10, type: !18, scopeLine: 10, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4)
88!15 = distinct !DISubprogram(name: "main", scope: !4, file: !3, line: 7, type: !16, scopeLine: 7, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !4)
89!16 = !DISubroutineType(cc: DW_CC_program, types: !17)
90!17 = !{null}
91!18 = !DISubroutineType(types: !17)
92!19 = !{!20}
93!20 = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "var4", scope: !14, entity: !1, file: !3, line: 10)
94!21 = !{i32 2, !"Dwarf Version", i32 4}
95!22 = !{i32 2, !"Debug Info Version", i32 3}
96!23 = !DILocation(line: 8, column: 1, scope: !15)
97!24 = !DILocation(line: 9, column: 1, scope: !15)
98!25 = !DILocation(line: 13, column: 1, scope: !14)
99