1 ;; This test checks Backward compatibility of DIImportedEntity
2 ; REQUIRES: x86_64-linux
4 ; RUN: llvm-dis -o - %s.bc | FileCheck %s
6 ;Test whether DIImportedEntity are generated correctly.
7 ; CHECK: [[SP:![0-9]+]] = distinct !DISubprogram(name: "use_renamed"
8 ; CHECK-SAME: retainedNodes: [[IMPORTS:![0-9]+]]
9 ; CHECK: [[IMPORTS]] = !{[[IMPORT1:![0-9]+]], [[IMPORT2:![0-9]+]]}
10 ; CHECK: [[IMPORT1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[SP]], entity: {{![0-9]+}}, file: {{![0-9]+}}, line: {{[0-9]+}})
11 ; CHECK: [[IMPORT2]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "var4", scope: [[SP]], entity: {{![0-9]+}}, file: {{![0-9]+}}, line: {{[0-9]+}})
13 ; ModuleID = 'DIImportedEntity_backward.bc'
14 source_filename = "/tmp/usemodulealias.ll"
16 %struct_mymod_8_ = type <{ [12 x i8] }>
17 %struct.struct_ul_MAIN__348 = type { i8* }
19 @_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
20 @.C330_MAIN_ = internal constant i32 0
21 @.C364_main_use_renamed = internal constant i32 25
22 @.C330_main_use_renamed = internal constant i32 0
23 @.C331_main_use_renamed = internal constant i64 0
24 @.C359_main_use_renamed = internal constant i32 6
25 @.C357_main_use_renamed = internal constant [18 x i8] c"usemodulealias.f90"
26 @.C352_main_use_renamed = internal constant i32 12
28 define i32 @mymod_() {
33 define void @MAIN_() !dbg !15 {
35 %.S0000_353 = alloca %struct.struct_ul_MAIN__348, align 8
36 %0 = bitcast i32* @.C330_MAIN_ to i8*
37 %1 = bitcast void (...)* @fort_init to void (i8*, ...)*
38 call void (i8*, ...) %1(i8* %0)
41 L.LB2_357: ; preds = %L.entry
42 %2 = bitcast %struct.struct_ul_MAIN__348* %.S0000_353 to i64*, !dbg !22
43 call void @main_use_renamed(i64* %2), !dbg !22
47 define internal void @main_use_renamed(i64* noalias %.S0000) !dbg !14 {
52 declare void @fort_init(...)
54 !llvm.module.flags = !{!20, !21}
57 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
58 !1 = distinct !DIGlobalVariable(name: "var1", scope: !2, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true)
59 !2 = !DIModule(scope: !4, name: "mymod", file: !3, line: 1)
60 !3 = !DIFile(filename: "DIImportedEntity_backward.f90", directory: "/tmp")
61 !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: !5, nameTableKind: None)
64 !7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_plus_uconst, 4))
65 !8 = distinct !DIGlobalVariable(name: "var2", scope: !2, file: !3, line: 3, type: !9, isLocal: false, isDefinition: true)
66 !9 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
67 !10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression(DW_OP_plus_uconst, 8))
68 !11 = distinct !DIGlobalVariable(name: "var3", scope: !2, file: !3, line: 4, type: !9, isLocal: false, isDefinition: true)
70 !13 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !14, entity: !2, file: !3, line: 10)
71 !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)
72 !15 = distinct !DISubprogram(name: "main", scope: !4, file: !3, line: 7, type: !16, scopeLine: 7, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !4)
73 !16 = !DISubroutineType(cc: DW_CC_program, types: !17)
75 !18 = !DISubroutineType(types: !17)
76 !19 = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "var4", scope: !14, entity: !1, file: !3, line: 10)
77 !20 = !{i32 2, !"Dwarf Version", i32 4}
78 !21 = !{i32 2, !"Debug Info Version", i32 3}
79 !22 = !DILocation(line: 8, column: 1, scope: !15)
80 !23 = !DILocation(line: 9, column: 1, scope: !15)
81 !24 = !DILocation(line: 13, column: 1, scope: !14)