1*18f8106fSJoel E. Denny; Check info on allocas. 2*18f8106fSJoel E. Denny 3*18f8106fSJoel E. Denny; RUN: opt -pass-remarks=kernel-info -passes=kernel-info \ 4*18f8106fSJoel E. Denny; RUN: -disable-output %s 2>&1 | \ 5*18f8106fSJoel E. Denny; RUN: FileCheck -match-full-lines %s 6*18f8106fSJoel E. Denny 7*18f8106fSJoel E. Dennytarget datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64" 8*18f8106fSJoel E. Dennytarget triple = "nvptx64-nvidia-cuda" 9*18f8106fSJoel E. Denny 10*18f8106fSJoel E. Dennydefine void @h() !dbg !100 { 11*18f8106fSJoel E. Dennyentry: 12*18f8106fSJoel E. Denny ; CHECK: remark: test.c:0:0: in artificial function 'h', artificial alloca ('%dyn_ptr.addr') for 'dyn_ptr' with static size of 8 bytes 13*18f8106fSJoel E. Denny %dyn_ptr.addr = alloca ptr, align 8 14*18f8106fSJoel E. Denny ; CHECK: remark: test.c:14:9: in artificial function 'h', alloca ('%i') for 'i' with static size of 4 bytes 15*18f8106fSJoel E. Denny %i = alloca i32, align 4 16*18f8106fSJoel E. Denny ; CHECK: remark: test.c:15:9: in artificial function 'h', alloca ('%a') for 'a' with static size of 8 bytes 17*18f8106fSJoel E. Denny %a = alloca [2 x i32], align 4 18*18f8106fSJoel E. Denny %size = load i32, ptr %i, align 4 19*18f8106fSJoel E. Denny ; CHECK: remark: test.c:16:9: in artificial function 'h', alloca ('%adyn') for 'adyn' with dynamic size 20*18f8106fSJoel E. Denny %adyn = alloca i32, i32 %size, align 4 21*18f8106fSJoel E. Denny ; CHECK: remark: <unknown>:0:0: in artificial function 'h', alloca ('%nodbg') without debug info with static size of 4 bytes 22*18f8106fSJoel E. Denny %nodbg = alloca i32, align 4 23*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %dyn_ptr.addr, metadata !110, metadata !DIExpression()), !dbg !114 24*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %i, metadata !120, metadata !DIExpression()), !dbg !121 25*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %a, metadata !130, metadata !DIExpression()), !dbg !131 26*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %adyn, metadata !140, metadata !DIExpression()), !dbg !141 27*18f8106fSJoel E. Denny br label %non-entry 28*18f8106fSJoel E. Denny 29*18f8106fSJoel E. Dennynon-entry: 30*18f8106fSJoel E. Denny ; CHECK: remark: test.c:17:9: in artificial function 'h', alloca ('%i2') for 'i2' with static size of 4 bytes 31*18f8106fSJoel E. Denny %i2 = alloca i32, align 4 32*18f8106fSJoel E. Denny %size2 = load i32, ptr %i2, align 4 33*18f8106fSJoel E. Denny ; CHECK: remark: test.c:18:9: in artificial function 'h', alloca ('%adyn2') for 'adyn2' with dynamic size 34*18f8106fSJoel E. Denny %adyn2 = alloca i32, i32 %size, align 4 35*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %i2, metadata !150, metadata !DIExpression()), !dbg !151 36*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %adyn2, metadata !160, metadata !DIExpression()), !dbg !161 37*18f8106fSJoel E. Denny ret void 38*18f8106fSJoel E. Denny} 39*18f8106fSJoel E. Denny; CHECK: remark: test.c:13:0: in artificial function 'h', Allocas = 7 40*18f8106fSJoel E. Denny; CHECK: remark: test.c:13:0: in artificial function 'h', AllocasStaticSizeSum = 28 41*18f8106fSJoel E. Denny; CHECK: remark: test.c:13:0: in artificial function 'h', AllocasDyn = 2 42*18f8106fSJoel E. Denny 43*18f8106fSJoel E. Dennydefine void @g() !dbg !200 { 44*18f8106fSJoel E. Dennyentry: 45*18f8106fSJoel E. Denny ; CHECK: remark: test.c:4:7: in function 'g', alloca ('%i') for 'i' with static size of 4 bytes 46*18f8106fSJoel E. Denny %i = alloca i32, align 4 47*18f8106fSJoel E. Denny ; CHECK: remark: test.c:5:7: in function 'g', alloca ('%a') for 'a' with static size of 8 bytes 48*18f8106fSJoel E. Denny %a = alloca [2 x i32], align 4 49*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %i, metadata !210, metadata !DIExpression()), !dbg !211 50*18f8106fSJoel E. Denny tail call void @llvm.dbg.declare(metadata ptr %a, metadata !220, metadata !DIExpression()), !dbg !221 51*18f8106fSJoel E. Denny ret void 52*18f8106fSJoel E. Denny} 53*18f8106fSJoel E. Denny; CHECK: remark: test.c:3:0: in function 'g', Allocas = 2 54*18f8106fSJoel E. Denny; CHECK: remark: test.c:3:0: in function 'g', AllocasStaticSizeSum = 12 55*18f8106fSJoel E. Denny; CHECK: remark: test.c:3:0: in function 'g', AllocasDyn = 0 56*18f8106fSJoel E. Denny 57*18f8106fSJoel E. Denny; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 58*18f8106fSJoel E. Dennydeclare void @llvm.dbg.declare(metadata, metadata, metadata) #0 59*18f8106fSJoel E. Denny 60*18f8106fSJoel E. Denny; uselistorder directives 61*18f8106fSJoel E. Dennyuselistorder ptr @llvm.dbg.declare, { 7, 6, 5, 4, 3, 2, 1, 0 } 62*18f8106fSJoel E. Denny 63*18f8106fSJoel E. Dennyattributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } 64*18f8106fSJoel E. Denny 65*18f8106fSJoel E. Denny!llvm.module.flags = !{!0} 66*18f8106fSJoel E. Denny!llvm.dbg.cu = !{!1} 67*18f8106fSJoel E. Denny 68*18f8106fSJoel E. Denny!0 = !{i32 2, !"Debug Info Version", i32 3} 69*18f8106fSJoel E. Denny!1 = distinct !DICompileUnit(language: DW_LANG_C11, file: !2, producer: "clang version 19.0.0git", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) 70*18f8106fSJoel E. Denny!2 = !DIFile(filename: "test.c", directory: "/tmp") 71*18f8106fSJoel E. Denny!3 = !{null} 72*18f8106fSJoel E. Denny!4 = !{} 73*18f8106fSJoel E. Denny 74*18f8106fSJoel E. Denny!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 75*18f8106fSJoel E. Denny 76*18f8106fSJoel E. Denny!20 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !21) 77*18f8106fSJoel E. Denny!21 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !22) 78*18f8106fSJoel E. Denny!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) 79*18f8106fSJoel E. Denny 80*18f8106fSJoel E. Denny!30 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, size: 64, elements: !31) 81*18f8106fSJoel E. Denny!31 = !{!32} 82*18f8106fSJoel E. Denny!32 = !DISubrange(count: 2) 83*18f8106fSJoel E. Denny 84*18f8106fSJoel E. Denny!40 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, elements: !41) 85*18f8106fSJoel E. Denny!41 = !{!42} 86*18f8106fSJoel E. Denny!42 = !DISubrange(count: !43) 87*18f8106fSJoel E. Denny!43 = !DILocalVariable(name: "__vla_expr0", scope: !100, type: !10, flags: DIFlagArtificial) 88*18f8106fSJoel E. Denny 89*18f8106fSJoel E. Denny!100 = distinct !DISubprogram(name: "h", scope: !2, file: !2, line: 13, type: !101, scopeLine: 13, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !1, retainedNodes: !4) 90*18f8106fSJoel E. Denny!101 = distinct !DISubroutineType(types: !3) 91*18f8106fSJoel E. Denny 92*18f8106fSJoel E. Denny!110 = !DILocalVariable(name: "dyn_ptr", arg: 1, scope: !100, type: !20, flags: DIFlagArtificial) 93*18f8106fSJoel E. Denny!114 = !DILocation(line: 0, scope: !100) 94*18f8106fSJoel E. Denny 95*18f8106fSJoel E. Denny!120 = !DILocalVariable(name: "i", scope: !100, file: !2, line: 14, type: !10) 96*18f8106fSJoel E. Denny!121 = !DILocation(line: 14, column: 9, scope: !100) 97*18f8106fSJoel E. Denny 98*18f8106fSJoel E. Denny!130 = !DILocalVariable(name: "a", scope: !100, file: !2, line: 15, type: !30) 99*18f8106fSJoel E. Denny!131 = !DILocation(line: 15, column: 9, scope: !100) 100*18f8106fSJoel E. Denny 101*18f8106fSJoel E. Denny!140 = !DILocalVariable(name: "adyn", scope: !100, file: !2, line: 16, type: !40) 102*18f8106fSJoel E. Denny!141 = !DILocation(line: 16, column: 9, scope: !100) 103*18f8106fSJoel E. Denny 104*18f8106fSJoel E. Denny!150 = !DILocalVariable(name: "i2", scope: !100, file: !2, line: 17, type: !10) 105*18f8106fSJoel E. Denny!151 = !DILocation(line: 17, column: 9, scope: !100) 106*18f8106fSJoel E. Denny 107*18f8106fSJoel E. Denny!160 = !DILocalVariable(name: "adyn2", scope: !100, file: !2, line: 18, type: !40) 108*18f8106fSJoel E. Denny!161 = !DILocation(line: 18, column: 9, scope: !100) 109*18f8106fSJoel E. Denny 110*18f8106fSJoel E. Denny!200 = distinct !DISubprogram(name: "g", scope: !2, file: !2, line: 3, type: !201, scopeLine: 3, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !4) 111*18f8106fSJoel E. Denny!201 = !DISubroutineType(types: !3) 112*18f8106fSJoel E. Denny 113*18f8106fSJoel E. Denny!210 = !DILocalVariable(name: "i", scope: !200, file: !2, line: 4, type: !10) 114*18f8106fSJoel E. Denny!211 = !DILocation(line: 4, column: 7, scope: !200) 115*18f8106fSJoel E. Denny 116*18f8106fSJoel E. Denny!220 = !DILocalVariable(name: "a", scope: !200, file: !2, line: 5, type: !30) 117*18f8106fSJoel E. Denny!221 = !DILocation(line: 5, column: 7, scope: !200) 118