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