1;; This test checks whether DW_OP_consts is emitted correctly. 2 3; RUN: llc %s -mtriple=x86_64 -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s 4 5;; Test whether DW_AT_data_location is generated. 6; CHECK-LABEL: DW_TAG_array_type 7 8;; Check whether negative values are emitted correctly. 9; CHECK: DW_AT_rank (DW_OP_consts -1) 10; CHECK: DW_TAG_generic_subrange 11;; Check whether positive values are emitted correctly. 12; CHECK: DW_AT_lower_bound (DW_OP_push_object_address, DW_OP_over, DW_OP_consts +48, DW_OP_mul, DW_OP_plus_uconst 0x50, DW_OP_plus, DW_OP_deref) 13; CHECK: DW_AT_upper_bound (DW_OP_push_object_address, DW_OP_over, DW_OP_consts +48, DW_OP_mul, DW_OP_plus_uconst 0x78, DW_OP_plus, DW_OP_deref) 14; CHECK: DW_AT_byte_stride (DW_OP_push_object_address, DW_OP_over, DW_OP_consts +48, DW_OP_mul, DW_OP_plus_uconst 0x70, DW_OP_plus, DW_OP_deref, DW_OP_consts +4, DW_OP_mul) 15 16;; Test case is hand written with the help of below testcase 17;;------------------------------ 18;;subroutine sub(arank) 19;; real :: arank(..) 20;; print *, RANK(arank) 21;;end 22;;------------------------------ 23 24; ModuleID = 'dwarfdump-signed_const.ll' 25source_filename = "dwarfdump-signed_const.ll" 26 27define void @sub_(ptr noalias %arank, ptr noalias %"arank$sd") !dbg !5 { 28L.entry: 29 call void @llvm.dbg.value(metadata ptr %arank, metadata !17, metadata !DIExpression()), !dbg !18 30 call void @llvm.dbg.declare(metadata ptr %"arank$sd", metadata !19, metadata !DIExpression()), !dbg !18 31 call void @llvm.dbg.declare(metadata ptr %"arank$sd", metadata !29, metadata !DIExpression()), !dbg !18 32 ret void, !dbg !18 33} 34 35; Function Attrs: nounwind readnone speculatable willreturn 36declare void @llvm.dbg.declare(metadata, metadata, metadata) 37 38; Function Attrs: nounwind readnone speculatable willreturn 39declare void @llvm.dbg.value(metadata, metadata, metadata) 40 41!llvm.module.flags = !{!0, !1} 42!llvm.dbg.cu = !{!2} 43 44!0 = !{i32 2, !"Dwarf Version", i32 4} 45!1 = !{i32 2, !"Debug Info Version", i32 3} 46!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) 47!3 = !DIFile(filename: "generic_signed_const.f90", directory: "/dir") 48!4 = !{} 49!5 = distinct !DISubprogram(name: "sub", scope: !2, file: !3, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !2) 50!6 = !DISubroutineType(types: !7) 51!7 = !{null, !8, !14} 52!8 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 32, align: 32, elements: !10) 53!9 = !DIBasicType(name: "real", size: 32, align: 32, encoding: DW_ATE_float) 54!10 = !{!11} 55!11 = !DISubrange(lowerBound: 1, upperBound: !12) 56!12 = distinct !DILocalVariable(scope: !5, file: !3, type: !13, flags: DIFlagArtificial) 57!13 = !DIBasicType(name: "integer*8", size: 64, align: 64, encoding: DW_ATE_signed) 58!14 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 1024, align: 64, elements: !15) 59!15 = !{!16} 60!16 = !DISubrange(lowerBound: 1, upperBound: 16) 61!17 = distinct !DILocalVariable(scope: !5, file: !3, type: !13, flags: DIFlagArtificial) 62!18 = !DILocation(line: 0, scope: !5) 63!19 = !DILocalVariable(name: "arank", arg: 1, scope: !5, file: !3, line: 1, type: !20) 64;; 18446744073709551615 = (unsigned long long) -1 is representation for -1 65!20 = !DICompositeType(tag: DW_TAG_array_type, baseType: !9, size: 32, align: 32, elements: !21, dataLocation: !17, rank: !DIExpression(DW_OP_consts, 18446744073709551615)) 66!21 = !{!22} 67!22 = !DIGenericSubrange(lowerBound: !DIExpression(DW_OP_push_object_address, DW_OP_over, DW_OP_consts, 48, DW_OP_mul, DW_OP_plus_uconst, 80, DW_OP_plus, DW_OP_deref), upperBound: !DIExpression(DW_OP_push_object_address, DW_OP_over, DW_OP_consts, 48, DW_OP_mul, DW_OP_plus_uconst, 120, DW_OP_plus, DW_OP_deref), stride: !DIExpression(DW_OP_push_object_address, DW_OP_over, DW_OP_consts, 48, DW_OP_mul, DW_OP_plus_uconst, 112, DW_OP_plus, DW_OP_deref, DW_OP_consts, 4, DW_OP_mul)) 68!29 = !DILocalVariable(arg: 2, scope: !5, file: !3, line: 1, type: !14, flags: DIFlagArtificial) 69