xref: /llvm-project/llvm/test/Bitcode/fortranSubrange.ll (revision d20bf5a7258d4b6a7f017a81b125275dac1aa166)
1;; This test checks DISubrange bounds
2
3; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
4
5;; Test whether bounds are generated correctly.
6; CHECK: !{{[0-9]+}} = !DISubrange(lowerBound: 3, upperBound: ![[NODE:[0-9]+]], stride: !DIExpression(DW_OP_constu, 4))
7; CHECK: ![[NODE]] = distinct !DILocalVariable
8
9
10; ModuleID = 'fortsubrange.ll'
11source_filename = "fortsubrange.ll"
12
13define void @MAIN_() !dbg !5 {
14L.entry:
15  %.Z0640_333 = alloca i32*, align 8
16  %"arr$sd1_349" = alloca [16 x i64], align 8
17  call void @llvm.dbg.declare(metadata i32** %.Z0640_333, metadata !8, metadata !DIExpression(DW_OP_deref)), !dbg !15
18  call void @llvm.dbg.declare(metadata [16 x i64]* %"arr$sd1_349", metadata !13, metadata !DIExpression(DW_OP_plus_uconst, 120)), !dbg !15
19  ret void, !dbg !16
20}
21
22; Function Attrs: nounwind readnone speculatable willreturn
23declare void @llvm.dbg.declare(metadata, metadata, metadata)
24
25!llvm.module.flags = !{!0, !1}
26!llvm.dbg.cu = !{!2}
27
28!0 = !{i32 2, !"Dwarf Version", i32 4}
29!1 = !{i32 2, !"Debug Info Version", i32 3}
30!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)
31!3 = !DIFile(filename: "fortsubrange.f90", directory: "/dir")
32!4 = !{}
33!5 = distinct !DISubprogram(name: "main", scope: !2, file: !3, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagMainSubprogram, unit: !2)
34!6 = !DISubroutineType(cc: DW_CC_program, types: !7)
35!7 = !{null}
36!8 = !DILocalVariable(name: "arr", scope: !5, file: !3, type: !9)
37!9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 32, align: 32, elements: !11)
38!10 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)
39!11 = !{!12}
40!12 = !DISubrange(lowerBound: 3, upperBound: !13, stride: !DIExpression(DW_OP_constu, 4))
41!13 = distinct !DILocalVariable(scope: !5, file: !3, type: !14, flags: DIFlagArtificial)
42!14 = !DIBasicType(name: "integer*8", size: 64, align: 64, encoding: DW_ATE_signed)
43!15 = !DILocation(line: 0, scope: !5)
44!16 = !DILocation(line: 6, column: 1, scope: !5)
45