1 ; RUN: llc %s -O2 -filetype=obj -o %t.o
2 ; RUN: llvm-dwarfdump %t.o | FileCheck %s
4 ; Test whether DW_AT_data_location is generated.
5 ; CHECK-LABEL: DW_TAG_array_type
6 ; CHECK: DW_AT_allocated (DW_OP_push_object_address, DW_OP_deref)
8 ; CHECK: DW_TAG_subrange_type
10 ; Test case is hand written with the help of below testcase
11 ;------------------------------
13 ;integer, allocatable :: arr(:)
18 ;------------------------------
20 ; ModuleID = 'allocated.ll'
21 source_filename = "allocated.ll"
22 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
23 target triple = "x86_64-unknown-linux-gnu"
25 define void @MAIN_() !dbg !5 {
27 %.Z0640_333 = alloca ptr, align 8
28 %"arr$sd1_349" = alloca [16 x i64], align 8
29 call void @llvm.dbg.declare(metadata ptr %"arr$sd1_349", metadata !8, metadata !DIExpression()), !dbg !13
30 call void @llvm.dbg.declare(metadata ptr %.Z0640_333, metadata !14, metadata !DIExpression()), !dbg !13
34 ; Function Attrs: nounwind readnone speculatable willreturn
35 declare void @llvm.dbg.declare(metadata, metadata, metadata)
37 !llvm.module.flags = !{!0, !1}
40 !0 = !{i32 2, !"Dwarf Version", i32 4}
41 !1 = !{i32 2, !"Debug Info Version", i32 3}
42 !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)
43 !3 = !DIFile(filename: "allocated.f90", directory: "/dir")
45 !5 = distinct !DISubprogram(name: "main", scope: !2, file: !3, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !2)
46 !6 = !DISubroutineType(cc: DW_CC_program, types: !7)
48 !8 = !DILocalVariable(name: "arr", scope: !5, file: !3, type: !9)
49 !9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 32, align: 32, elements: !11, dataLocation: !DIExpression(DW_OP_push_object_address, DW_OP_deref), allocated: !DIExpression(DW_OP_push_object_address, DW_OP_deref))
50 !10 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
52 !12 = !DISubrange(count: 19, lowerBound: 2)
53 !13 = !DILocation(line: 0, scope: !5)
54 !14 = distinct !DILocalVariable(scope: !5, file: !3, type: !15, flags: DIFlagArtificial)
55 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 32, align: 32)
56 !16 = !DILocation(line: 6, column: 1, scope: !5)