1 ;; This test checks whether DW_AT_data_location attribute
4 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -filetype=obj -o %t.o
5 ; RUN: llvm-dwarfdump %t.o | FileCheck %s
7 ;; Test whether DW_AT_data_location is generated.
8 ; CHECK: [[ALCDIE:0x.+]]: DW_TAG_variable
9 ; CHECK: DW_AT_type ({{0x[0-9]+}} "logical")
10 ; CHECK: [[LOCDIE:0x.+]]: DW_TAG_variable
11 ; CHECK: DW_AT_type ({{0x[0-9]+}} "integer *")
12 ; CHECK: DW_AT_artificial (true)
13 ; CHECK: DW_TAG_variable
14 ; CHECK: DW_AT_name ("arr")
15 ; CHECK: DW_TAG_array_type
16 ; CHECK-NEXT: DW_AT_data_location ([[LOCDIE]])
17 ; CHECK-NEXT: DW_AT_associated ([[ALCDIE]])
19 ;; Test case is hand written with the help of below testcase
20 ;;------------------------------
22 ;;integer, pointer :: arr(:)
27 ;;------------------------------
29 ; ModuleID = 'associated.ll'
30 source_filename = "associated.ll"
31 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
32 target triple = "x86_64-unknown-linux-gnu"
34 define void @MAIN_() !dbg !5 {
36 %.Z0640_333 = alloca ptr, align 8
37 %"arr$sd1_349" = alloca [16 x i64], align 8
38 call void @llvm.dbg.declare(metadata ptr %"arr$sd1_349", metadata !8, metadata !DIExpression()), !dbg !17
39 call void @llvm.dbg.declare(metadata ptr %.Z0640_333, metadata !13, metadata !DIExpression()), !dbg !17
40 call void @llvm.dbg.declare(metadata ptr %.Z0640_333, metadata !15, metadata !DIExpression()), !dbg !17
44 ; Function Attrs: nounwind readnone speculatable willreturn
45 declare void @llvm.dbg.declare(metadata, metadata, metadata)
47 !llvm.module.flags = !{!0, !1}
50 !0 = !{i32 2, !"Dwarf Version", i32 4}
51 !1 = !{i32 2, !"Debug Info Version", i32 3}
52 !2 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: " F90 Flang - 1.5 2017-05-01", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !4, imports: !4)
53 !3 = !DIFile(filename: "associated.f90", directory: "/dir")
55 !5 = distinct !DISubprogram(name: "main", scope: !2, file: !3, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !2)
56 !6 = !DISubroutineType(cc: DW_CC_program, types: !7)
58 !8 = !DILocalVariable(name: "arr", scope: !5, file: !3, type: !9)
59 !9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 32, align: 32, elements: !11, dataLocation: !13, associated: !15)
60 !10 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
62 !12 = !DISubrange(count: 19, lowerBound: 2)
63 !13 = distinct !DILocalVariable(scope: !5, file: !3, type: !14, flags: DIFlagArtificial)
64 !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 32, align: 32)
65 !15 = distinct !DILocalVariable(scope: !5, file: !3, type: !16, flags: DIFlagArtificial)
66 !16 = !DIBasicType(name: "logical", size: 32, align: 32, encoding: DW_ATE_signed)
67 !17 = !DILocation(line: 0, scope: !5)
68 !18 = !DILocation(line: 6, column: 1, scope: !5)