This is needed to dump optimized debugging information where all names in a module are imported, but a few names are imported with overriding aliases Please consider blow test case.
```````````````````
module mymod integer :: var1 = 11 integer :: var2 = 12 integer :: var3 = 13 end module mymod Program main call use_renamed() contains subroutine use_renamed() use mymod, var4 => var1 print *, var4 end subroutine use_renamed end program main
```````````````````
Which currently produces IR as
```
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = distinct !DIGlobalVariable(name: "var1", scope: !2, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true) !2 = !DIModule(scope: !4, name: "mymod", file: !3, line: 1) !3 = !DIFile(filename: "usemodulealias.f90", directory: "/tmp") !4 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: " F90 Flang - 1.5 2017-05-01", isOptimized: false, flags: "'+flang -g -S -emit-llvm usemodulealias.f90'", runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, **imports: !12**, nameTableKind: None) !5 = !{} !6 = !{!0, !7, !10} !7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_plus_uconst, 4)) !8 = distinct !DIGlobalVariable(name: "var2", scope: !2, file: !3, line: 3, type: !9, isLocal: false, isDefinition: true) !9 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed) !10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression(DW_OP_plus_uconst, 8)) !11 = distinct !DIGlobalVariable(name: "var3", scope: !2, file: !3, line: 4, type: !9, isLocal: false, isDefinition: true) ** !12 = !{!13, !19, !20}** !13 = !**DIImportedEntity**(tag: DW_TAG_imported_declaration, scope: !14, entity: !11, file: !3, line: 10) !14 = distinct !DISubprogram(name: "use_renamed", scope: !15, file: !3, line: 10, type: !18, scopeLine: 10, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4) !15 = distinct !DISubprogram(name: "main", scope: !4, file: !3, line: 7, type: !16, scopeLine: 7, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !4) !16 = !DISubroutineType(cc: DW_CC_program, types: !17) !17 = !{null} !18 = !DISubroutineType(types: !17) !19 = !**DIImportedEntity**(tag: DW_TAG_imported_declaration, scope: !14, entity: !8, file: !3, line: 10) !20 = !**DIImportedEntity**(tag: DW_TAG_imported_declaration, name: "var4", scope: !14, entity: !1, file: !3, line: 10)
``````
Please consider an imported Module having one renamed member out of total thousand members. With above representation we need to generate thousand DIImportedEntity's for each member. which can be optimize to
`````
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) !1 = distinct !DIGlobalVariable(name: "var1", scope: !2, file: !3, line: 2, type: !9, isLocal: false, isDefinition: true) !2 = !DIModule(scope: !4, name: "mymod", file: !3, line: 1) !3 = !DIFile(filename: "usemodulealias.f90", directory: "/tmp") !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) !5 = !{} !6 = !{!0, !7, !10} !7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_plus_uconst, 4)) !8 = distinct !DIGlobalVariable(name: "var2", scope: !2, file: !3, line: 3, type: !9, isLocal: false, isDefinition: true) !9 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed) !10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression(DW_OP_plus_uconst, 8)) !11 = distinct !DIGlobalVariable(name: "var3", scope: !2, file: !3, line: 4, type: !9, isLocal: false, isDefinition: true) **!12 = !{!13}** !13 = !**DIImportedEntity**(tag: DW_TAG_imported_module, scope: !14, entity: !2, file: !3, line: 10, **elements**: **!19**) !14 = distinct !DISubprogram(name: "use_renamed", scope: !15, file: !3, line: 10, type: !18, scopeLine: 10, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !4) **!19 = !{!20}** ** !20 = !DIImportedEntity**(tag: DW_TAG_imported_declaration, **name: "var4"**, scope: !14, entity: !1, file: !3, line: 10)
`````````````````
DIImportedEntity should include elements field which includes renamed variables only.