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