• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=x86_64-apple-darwin %s -o - -filetype=obj | llvm-dwarfdump - | FileCheck %s
2; Test debug info for multidimensional arrays.
3;
4; void f(int i, int j, int k, int r) {
5;  int tensor1[i][j][k][r];
6;  int tensor2[i][j][k][r];
7;  use(tensor1, tensor2);
8;}
9;
10; CHECK:        DW_TAG_array_type
11; CHECK-NEXT:     DW_AT_type	(0x000000f8 "int")
12; CHECK-NOT: TAG
13; CHECK:          DW_TAG_subrange_type
14; CHECK-NEXT:       DW_AT_type	(0x{{.*}}"__ARRAY_SIZE_TYPE__")
15; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
16; CHECK-NOT: TAG
17; CHECK:          DW_TAG_subrange_type
18; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "__ARRAY_SIZE_TYPE__")
19; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
20; CHECK-NOT: TAG
21; CHECK:          DW_TAG_subrange_type
22; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "__ARRAY_SIZE_TYPE__")
23; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
24; CHECK-NOT: TAG
25; CHECK:          DW_TAG_subrange_type
26; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "__ARRAY_SIZE_TYPE__")
27; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
28; CHECK:        DW_TAG_array_type
29; CHECK-NEXT:     DW_AT_type	(0x000000f8 "int")
30; CHECK-NOT: TAG
31; CHECK:          DW_TAG_subrange_type
32; CHECK-NEXT:       DW_AT_type	(0x{{.*}}"__ARRAY_SIZE_TYPE__")
33; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
34; CHECK-NOT: TAG
35; CHECK:          DW_TAG_subrange_type
36; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "__ARRAY_SIZE_TYPE__")
37; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
38; CHECK-NOT: TAG
39; CHECK:          DW_TAG_subrange_type
40; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "__ARRAY_SIZE_TYPE__")
41; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
42; CHECK-NOT: TAG
43; CHECK:          DW_TAG_subrange_type
44; CHECK-NEXT:       DW_AT_type	(0x{{.*}} "__ARRAY_SIZE_TYPE__")
45; CHECK-NEXT:       DW_AT_count	(0x{{.*}})
46
47
48source_filename = "/tmp/test.c"
49target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
50target triple = "x86_64-apple-macosx10.13.0"
51
52define void @f(i32 %i, i32 %j, i32 %k, i32 %r) !dbg !8 {
53entry:
54  call void @llvm.dbg.value(metadata i32 %i, metadata !39, metadata !DIExpression()), !dbg !40
55  call void @llvm.dbg.value(metadata i32 %j, metadata !38, metadata !DIExpression()), !dbg !40
56  call void @llvm.dbg.value(metadata i32 %k, metadata !37, metadata !DIExpression()), !dbg !40
57  call void @llvm.dbg.value(metadata i32 %r, metadata !36, metadata !DIExpression()), !dbg !40
58  %0 = zext i32 %i to i64, !dbg !40
59  %1 = zext i32 %j to i64, !dbg !40
60  %2 = zext i32 %k to i64, !dbg !40
61  %3 = zext i32 %r to i64, !dbg !40
62  %4 = mul nuw i64 %1, %0, !dbg !40
63  %5 = mul nuw i64 %4, %2, !dbg !40
64  %6 = mul nuw i64 %5, %3, !dbg !40
65  %vla = alloca i32, i64 %6, align 16, !dbg !40
66  call void @llvm.dbg.declare(metadata i32* %vla, metadata !25, metadata !DIExpression()), !dbg !40
67  call void @llvm.dbg.declare(metadata i32* %vla4, metadata !13, metadata !DIExpression()), !dbg !40
68  %vla4 = alloca i32, i64 %6, align 16, !dbg !40
69  call void @llvm.dbg.value(metadata i32 %i, metadata !29, metadata !DIExpression()), !dbg !40
70  call void @llvm.dbg.value(metadata i32 %j, metadata !31, metadata !DIExpression()), !dbg !40
71  call void @llvm.dbg.value(metadata i32 %k, metadata !33, metadata !DIExpression()), !dbg !40
72  call void @llvm.dbg.value(metadata i32 %r, metadata !35, metadata !DIExpression()), !dbg !40
73  call void @llvm.dbg.value(metadata i32 %i, metadata !17, metadata !DIExpression()), !dbg !40
74  call void @llvm.dbg.value(metadata i32 %j, metadata !20, metadata !DIExpression()), !dbg !40
75  call void @llvm.dbg.value(metadata i32 %k, metadata !22, metadata !DIExpression()), !dbg !40
76  call void @llvm.dbg.value(metadata i64 %3, metadata !24, metadata !DIExpression()), !dbg !40
77  %call = call i32 (i32*, i32*, ...) bitcast (i32 (...)* @use to i32 (i32*, i32*, ...)*)(i32* nonnull %vla, i32* nonnull %vla4) #1, !dbg !40
78  ret void, !dbg !40
79}
80
81; Function Attrs: nounwind readnone speculatable
82declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
83
84declare i32 @use(...) local_unnamed_addr
85
86; Function Attrs: nounwind readnone speculatable
87declare void @llvm.dbg.value(metadata, metadata, metadata) #0
88
89attributes #0 = { nounwind readnone speculatable }
90attributes #1 = { minsize nounwind optsize }
91
92!llvm.dbg.cu = !{!0}
93!llvm.module.flags = !{!3, !4, !5, !6}
94!llvm.ident = !{!7}
95
96!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 (trunk 324259) (llvm/trunk 324261)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
97!1 = !DIFile(filename: "/tmp/test.c", directory: "/")
98!2 = !{}
99!3 = !{i32 2, !"Dwarf Version", i32 4}
100!4 = !{i32 2, !"Debug Info Version", i32 3}
101!5 = !{i32 1, !"wchar_size", i32 4}
102!6 = !{i32 7, !"PIC Level", i32 2}
103!7 = !{!"clang version 7.0.0 (trunk 324259) (llvm/trunk 324261)"}
104!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
105!9 = !DISubroutineType(types: !10)
106!10 = !{null, !11, !11, !11, !11}
107!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
108!12 = !{!13, !24, !22, !20, !17, !25, !35, !33, !31, !29, !36, !37, !38, !39}
109!13 = !DILocalVariable(name: "tensor2", scope: !8, file: !1, line: 3, type: !14)
110!14 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, elements: !15)
111!15 = !{!16, !19, !21, !23}
112!16 = !DISubrange(count: !17)
113!17 = !DILocalVariable(name: "vla_expr5", scope: !8, file: !1, line: 3, type: !18)
114!18 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned)
115!19 = !DISubrange(count: !20)
116!20 = !DILocalVariable(name: "vla_expr6", scope: !8, file: !1, line: 3, type: !18)
117!21 = !DISubrange(count: !22)
118!22 = !DILocalVariable(name: "vla_expr7", scope: !8, file: !1, line: 3, type: !18)
119!23 = !DISubrange(count: !24)
120!24 = !DILocalVariable(name: "vla_expr8", scope: !8, file: !1, line: 3, type: !18)
121!25 = !DILocalVariable(name: "tensor1", scope: !8, file: !1, line: 2, type: !26)
122!26 = !DICompositeType(tag: DW_TAG_array_type, baseType: !11, elements: !27)
123!27 = !{!28, !30, !32, !34}
124!28 = !DISubrange(count: !29)
125!29 = !DILocalVariable(name: "vla_expr", scope: !8, file: !1, line: 2, type: !18)
126!30 = !DISubrange(count: !31)
127!31 = !DILocalVariable(name: "vla_expr1", scope: !8, file: !1, line: 2, type: !18)
128!32 = !DISubrange(count: !33)
129!33 = !DILocalVariable(name: "vla_expr2", scope: !8, file: !1, line: 2, type: !18)
130!34 = !DISubrange(count: !35)
131!35 = !DILocalVariable(name: "vla_expr3", scope: !8, file: !1, line: 2, type: !18)
132!36 = !DILocalVariable(name: "r", arg: 4, scope: !8, file: !1, line: 1, type: !11)
133!37 = !DILocalVariable(name: "k", arg: 3, scope: !8, file: !1, line: 1, type: !11)
134!38 = !DILocalVariable(name: "j", arg: 2, scope: !8, file: !1, line: 1, type: !11)
135!39 = !DILocalVariable(name: "i", arg: 1, scope: !8, file: !1, line: 1, type: !11)
136!40 = !DILocation(line: 2, column: 3, scope: !8)
137