88 lines · plain
1; RUN: mlir-translate -import-llvm -mlir-print-debuginfo -convert-debug-rec-to-intrinsics -emit-expensive-warnings -split-input-file %s 2>&1 | FileCheck %s2; RUN: mlir-translate -import-llvm -mlir-print-debuginfo -emit-expensive-warnings -split-input-file %s 2>&1 | FileCheck %s3 4; CHECK: #[[LOCAL_VAR0:.*]] = #llvm.di_local_variable<scope = #di_lexical_block>5; CHECK: #[[LOCAL_VAR1:.*]] = #llvm.di_local_variable<scope = #di_lexical_block_file, name = "arg"6; CHECK: #[[LOCAL_VAR2:.*]] = #llvm.di_local_variable<scope = #di_lexical_block, name = "alloc"7 8; CHECK: @callee()9define void @callee() {10 ret void11}12 13define void @func_with_empty_named_info() {14 call void @callee()15 ret void16}17 18define void @func_no_debug() {19 ret void20}21 22; CHECK: llvm.func @func_with_debug(%[[ARG0:.*]]: i6423define void @func_with_debug(i64 %0) !dbg !3 {24 25 ; CHECK: llvm.intr.dbg.value #[[LOCAL_VAR0]] = %[[ARG0]] : i6426 ; CHECK: llvm.intr.dbg.value #[[LOCAL_VAR1]] #llvm.di_expression<[DW_OP_LLVM_fragment(0, 1)]> = %[[ARG0]] : i6427 ; CHECK: %[[CST:.*]] = llvm.mlir.constant(1 : i32) : i3228 ; CHECK: %[[ADDR:.*]] = llvm.alloca %[[CST]] x i6429 ; CHECK: llvm.intr.dbg.declare #[[LOCAL_VAR2]] #llvm.di_expression<[DW_OP_deref, DW_OP_LLVM_convert(4, DW_ATE_signed)]> = %[[ADDR]] : !llvm.ptr30 %2 = alloca i64, align 8, !dbg !1931 #dbg_value(i64 %0, !20, !DIExpression(DW_OP_LLVM_fragment, 0, 1), !22)32 #dbg_declare(ptr %2, !23, !DIExpression(DW_OP_deref, DW_OP_LLVM_convert, 4, DW_ATE_signed), !25)33 #dbg_value(i64 %0, !26, !DIExpression(), !27)34 call void @func_no_debug(), !dbg !2835 %3 = add i64 %0, %0, !dbg !3236 ret void, !dbg !3737}38 39define void @empty_types() !dbg !38 {40 ret void, !dbg !4441}42 43!llvm.dbg.cu = !{!0}44!llvm.module.flags = !{!2}45 46!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "MLIR", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "test.dwo", emissionKind: FullDebug, nameTableKind: None)47!1 = !DIFile(filename: "foo.mlir", directory: "/test/")48!2 = !{i32 2, !"Debug Info Version", i32 3}49!3 = distinct !DISubprogram(name: "func_with_debug", linkageName: "func_with_debug", scope: !4, file: !1, line: 3, type: !6, scopeLine: 3, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)50!4 = !DINamespace(name: "nested", scope: !5)51!5 = !DINamespace(name: "toplevel", scope: null, exportSymbols: true)52!6 = !DISubroutineType(cc: DW_CC_normal, types: !7)53!7 = !{null, !8, !9, !11, !12, !13, !16}54!8 = !DIBasicType(name: "si64")55!9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, align: 32, offset: 8, extraData: !10)56!10 = !DIBasicType(name: "si32", size: 32, encoding: DW_ATE_signed)57!11 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "named", baseType: !10)58!12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, align: 32, offset: 8, dwarfAddressSpace: 3)59!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "composite", file: !1, line: 42, size: 64, align: 32, elements: !14)60!14 = !{!15}61!15 = !DISubrange(count: 4)62!16 = !DICompositeType(tag: DW_TAG_array_type, name: "array", file: !1, baseType: !8, flags: DIFlagVector, elements: !17)63!17 = !{!18}64!18 = !DISubrange(lowerBound: 0, upperBound: 4, stride: 1)65!19 = !DILocation(line: 100, column: 12, scope: !3)66!20 = !DILocalVariable(name: "arg", arg: 1, scope: !21, file: !1, line: 6, type: !8, align: 32)67!21 = distinct !DILexicalBlockFile(scope: !3, file: !1, discriminator: 0)68!22 = !DILocation(line: 103, column: 3, scope: !3)69!23 = !DILocalVariable(name: "alloc", scope: !24)70!24 = distinct !DILexicalBlock(scope: !3)71!25 = !DILocation(line: 106, column: 3, scope: !3)72!26 = !DILocalVariable(scope: !24)73!27 = !DILocation(line: 109, column: 3, scope: !3)74!28 = !DILocation(line: 1, column: 2, scope: !3)75!32 = !DILocation(line: 2, column: 4, scope: !33, inlinedAt: !36)76!33 = distinct !DISubprogram(name: "callee", scope: !13, file: !1, type: !34, spFlags: DISPFlagDefinition, unit: !0)77!34 = !DISubroutineType(types: !35)78!35 = !{!8, !8}79!36 = !DILocation(line: 28, column: 5, scope: !3)80!37 = !DILocation(line: 135, column: 3, scope: !3)81!38 = distinct !DISubprogram(name: "empty_types", scope: !39, file: !1, type: !40, spFlags: DISPFlagDefinition, unit: !0, annotations: !42)82!39 = !DIModule(scope: !1, name: "module", configMacros: "bar", includePath: "/", apinotes: "/", file: !1, line: 42, isDecl: true)83!40 = !DISubroutineType(cc: DW_CC_normal, types: !41)84!41 = !{}85!42 = !{!43}86!43 = !{!"foo", !"bar"}87!44 = !DILocation(line: 140, column: 3, scope: !38)88