69 lines · plain
1;; This test checks whether DW_AT_data_location attribute2;; accepts DIVariable3 4; RUN: llc -mtriple=x86_64-unknown-linux-gnu %s -filetype=obj -o %t.o5; RUN: llvm-dwarfdump %t.o | FileCheck %s6 7;; Test whether DW_AT_data_location is generated.8; CHECK: [[ALCDIE:0x.+]]: DW_TAG_variable9; CHECK: DW_AT_type ({{0x[0-9]+}} "logical")10; CHECK: [[LOCDIE:0x.+]]: DW_TAG_variable11; CHECK: DW_AT_type ({{0x[0-9]+}} "integer *")12; CHECK: DW_AT_artificial (true)13; CHECK: DW_TAG_variable14; CHECK: DW_AT_name ("arr")15; CHECK: DW_TAG_array_type16; CHECK-NEXT: DW_AT_data_location ([[LOCDIE]])17; CHECK-NEXT: DW_AT_allocated ([[ALCDIE]])18 19;; Test case is hand written with the help of below testcase20;;------------------------------21;;program main22;;integer, allocatable :: arr(:)23;;allocate(arr(2:20))24;;arr(2)=9925;;print *, arr26;;end program main27;;------------------------------28 29; ModuleID = 'allocated.ll'30source_filename = "allocated.ll"31target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"32target triple = "x86_64-unknown-linux-gnu"33 34define void @MAIN_() !dbg !5 {35L.entry:36 %.Z0640_333 = alloca ptr, align 837 %"arr$sd1_349" = alloca [16 x i64], align 838 call void @llvm.dbg.declare(metadata ptr %"arr$sd1_349", metadata !8, metadata !DIExpression()), !dbg !1739 call void @llvm.dbg.declare(metadata ptr %.Z0640_333, metadata !13, metadata !DIExpression()), !dbg !1740 call void @llvm.dbg.declare(metadata ptr %.Z0640_333, metadata !15, metadata !DIExpression()), !dbg !1741 ret void, !dbg !1842}43 44; Function Attrs: nounwind readnone speculatable willreturn45declare void @llvm.dbg.declare(metadata, metadata, metadata)46 47!llvm.module.flags = !{!0, !1}48!llvm.dbg.cu = !{!2}49 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: "allocated.f90", directory: "/dir")54!4 = !{}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)57!7 = !{null}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, allocated: !15)60!10 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)61!11 = !{!12}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)69