]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Bitcode/disubrange.ll
Vendor import of llvm trunk r351319 (just before the release_80 branch
[FreeBSD/FreeBSD.git] / test / Bitcode / disubrange.ll
1 ; Check that the DISubrange 'count' reference is correctly uniqued and restored,
2 ; since it can take the value of either a signed integer or a DIVariable.
3 ; RUN: llvm-as < %s | llvm-dis | FileCheck %s
4
5 define void @foo(i32 %n) {
6 entry:
7   %0 = zext i32 %n to i64
8   %vla = alloca i32, i64 %0, align 16
9   call void @llvm.dbg.declare(metadata i32* %vla, metadata !19, metadata !12), !dbg !18
10   ret void
11 }
12
13 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
14
15 !llvm.dbg.cu = !{!0}
16 !llvm.module.flags = !{!3, !4, !5}
17 !llvm.ident = !{!6}
18
19 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 5.0.1", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
20 !1 = !DIFile(filename: "vla.c", directory: "/path/to")
21 !2 = !{}
22 !3 = !{i32 2, !"Dwarf Version", i32 4}
23 !4 = !{i32 2, !"Debug Info Version", i32 3}
24 !5 = !{i32 1, !"wchar_size", i32 4}
25 !6 = !{!"clang version 5.0.1"}
26 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 20, type: !8, isLocal: false, isDefinition: true, scopeLine: 20, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !11)
27 !8 = !DISubroutineType(types: !9)
28 !9 = !{null, !10}
29 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
30 !11 = !{!16, !19}
31 !12 = !DIExpression()
32 !16 = !DILocalVariable(name: "vla_expr", scope: !7, file: !1, line: 21, type: !17)
33 !17 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)
34 !18 = !DILocation(line: 21, column: 7, scope: !7)
35 !19 = !DILocalVariable(name: "vla", scope: !7, file: !1, line: 21, type: !20)
36 !20 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, align: 32, elements: !21)
37 !21 = !{!22, !23, !24, !25, !26, !27}
38
39 ; CHECK-DAG: ![[NODE:[0-9]+]] = !DILocalVariable(name: "vla_expr"
40 ; CHECK-DAG: ![[RANGE:[0-9]+]] = !DISubrange(count: ![[NODE]])
41 ; CHECK-DAG: ![[CONST:[0-9]+]] = !DISubrange(count: 16)
42 ; CHECK-DAG: ![[MULTI:[0-9]+]] = !{![[RANGE]], ![[RANGE]], ![[CONST]], ![[CONST]], ![[CONST]], ![[CONST]]}
43 ; CHECK-DAG: elements: ![[MULTI]]
44 !22 = !DISubrange(count: !16)
45 !23 = !DISubrange(count: !16)
46 !24 = !DISubrange(count: 16)
47 !25 = !DISubrange(count: i16 16)
48 !26 = !DISubrange(count: i32 16)
49 !27 = !DISubrange(count: i64 16)