// RUN: mlir-translate -mlir-to-llvmir --split-input-file %s | FileCheck %s --check-prefixes=CHECK,RECORDS // XFAIL: * // CHECK-LABEL: define void @func_with_empty_named_info() // Check that translation doens't crash in the presence of an inlineble call // with a named loc that has no backing source info. llvm.func @callee() { llvm.return } loc("calleesource.cc":1:1) llvm.func @func_with_empty_named_info() { llvm.call @callee() : () -> () loc("named with no line info") llvm.return } // CHECK-LABEL: define void @func_no_debug() // CHECK-NOT: !dbg llvm.func @func_no_debug() { llvm.return loc(unknown) } loc(unknown) #file = #llvm.di_file<"foo.mlir" in "/test/"> #si64 = #llvm.di_basic_type< // Omit the optional parameters. tag = DW_TAG_base_type > #si32 = #llvm.di_basic_type< tag = DW_TAG_base_type, name = "si32", sizeInBits = 32, encoding = DW_ATE_signed > #ptr = #llvm.di_derived_type< tag = DW_TAG_pointer_type, baseType = #si32, sizeInBits = 64, alignInBits = 32, offsetInBits = 8, extraData = #si32 > #named = #llvm.di_derived_type< // Specify the name parameter. tag = DW_TAG_pointer_type, name = "named", baseType = #si32 > #ptrWithAddressSpace = #llvm.di_derived_type< tag = DW_TAG_pointer_type, baseType = #si32, sizeInBits = 64, alignInBits = 32, offsetInBits = 8, dwarfAddressSpace = 3 > #ptrWithFileLine = #llvm.di_derived_type< tag = DW_TAG_pointer_type, baseType = #si32, file = #file, line = 42, scope = #file > #flags = #llvm.di_derived_type< tag = DW_TAG_pointer_type, baseType = #si32, sizeInBits = 64, flags = "Artificial|ObjectPointer" > #cu = #llvm.di_compile_unit< id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #file, producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true, nameTableKind = None, splitDebugFilename = "test.dwo" > #composite = #llvm.di_composite_type< tag = DW_TAG_structure_type, name = "composite", file = #file, line = 42, sizeInBits = 64, alignInBits = 32, elements = #llvm.di_subrange > #vector = #llvm.di_composite_type< tag = DW_TAG_array_type, name = "array", file = #file, baseType = #si64, flags = Vector, elements = #llvm.di_subrange > #null = #llvm.di_null_type #spType0 = #llvm.di_subroutine_type #toplevel_namespace = #llvm.di_namespace< name = "toplevel", exportSymbols = true > #nested_namespace = #llvm.di_namespace< name = "nested", scope = #toplevel_namespace, exportSymbols = false > #sp0 = #llvm.di_subprogram< compileUnit = #cu, scope = #nested_namespace, name = "func_with_debug", linkageName = "func_with_debug", file = #file, line = 3, scopeLine = 3, subprogramFlags = "Definition|Optimized", type = #spType0 > #calleeType = #llvm.di_subroutine_type< // Omit the optional callingConvention parameter. types = #si64, #si64> #callee = #llvm.di_subprogram< // Omit the optional linkageName, line, and scopeLine parameters. compileUnit = #cu, scope = #composite, name = "callee", file = #file, subprogramFlags = "Definition", type = #calleeType > #fileScope = #llvm.di_lexical_block_file #blockScope = #llvm.di_lexical_block #variable = #llvm.di_local_variable #variableAddr = #llvm.di_local_variable #noNameVariable = #llvm.di_local_variable #module = #llvm.di_module< file = #file, scope = #file, name = "module", configMacros = "bar", includePath = "/", apinotes = "/", line = 42, isDecl = true > #spType1 = #llvm.di_subroutine_type #sp1 = #llvm.di_subprogram< compileUnit = #cu, scope = #module, name = "empty_types", file = #file, subprogramFlags = "Definition", type = #spType1, annotations = #llvm.di_annotation > // CHECK-LABEL: define void @func_with_debug( // CHECK-SAME: i64 %[[ARG:.*]]) !dbg ![[FUNC_LOC:[0-9]+]] llvm.func @func_with_debug(%arg: i64) { // CHECK: %[[ALLOC:.*]] = alloca %allocCount = llvm.mlir.constant(1 : i32) : i32 %alloc = llvm.alloca %allocCount x i64 : (i32) -> !llvm.ptr // RECORDS: #dbg_value(i64 %[[ARG]], ![[VAR_LOC:[0-9]+]], !DIExpression(DW_OP_LLVM_fragment, 0, 1), !{{.*}}) llvm.intr.dbg.value #variable #llvm.di_expression<[DW_OP_LLVM_fragment(0, 1)]> = %arg : i64 // RECORDS: #dbg_declare(ptr %[[ALLOC]], ![[ADDR_LOC:[0-9]+]], !DIExpression(DW_OP_deref, DW_OP_LLVM_convert, 4, DW_ATE_signed), !{{.*}}) llvm.intr.dbg.declare #variableAddr #llvm.di_expression<[DW_OP_deref, DW_OP_LLVM_convert(4, DW_ATE_signed)]> = %alloc : !llvm.ptr // RECORDS: #dbg_value(i64 %[[ARG]], ![[NO_NAME_VAR:[0-9]+]], !DIExpression(), !{{.*}}) llvm.intr.dbg.value #noNameVariable = %arg : i64 // CHECK: call void @func_no_debug(), !dbg ![[FILE_LOC:[0-9]+]] llvm.call @func_no_debug() : () -> () loc("foo.mlir":1:2) // CHECK: call void @func_no_debug(), !dbg ![[FILE_LOC:[0-9]+]] llvm.call @func_no_debug() : () -> () loc("foo.mlir":1:2 to 5:6) // CHECK: call void @func_no_debug(), !dbg ![[NAMED_LOC:[0-9]+]] llvm.call @func_no_debug() : () -> () loc("named"("foo.mlir":10:10)) // CHECK: call void @func_no_debug(), !dbg ![[MY_SOURCE_LOC:[0-9]+]] llvm.call @func_no_debug() : () -> () loc(callsite("nodebug.cc":3:4 at "mysource.cc":5:6)) // CHECK: call void @func_no_debug(), !dbg ![[MY_SOURCE_LOC]] llvm.call @func_no_debug() : () -> () loc(callsite("nodebug.cc":3:4 at fused<#sp0>["mysource.cc":5:6])) // CHECK: call void @func_no_debug(), !dbg ![[FUSED_LOC:[0-9]+]] llvm.call @func_no_debug() : () -> () loc(fused[callsite(fused<#callee>["mysource.cc":5:6] at "mysource.cc":1:1), "mysource.cc":1:1]) // CHECK: call void @func_no_debug(), !dbg ![[FUSEDWITH_LOC:[0-9]+]] llvm.call @func_no_debug() : () -> () loc(callsite(callsite(fused<#callee>["foo.mlir":2:4] at "foo.mlir":1:1) at fused<#sp0>["foo.mlir":28:5])) // CHECK: add i64 %[[ARG]], %[[ARG]], !dbg ![[FUSEDWITH_LOC]] %sum = llvm.add %arg, %arg : i64 loc(callsite(fused<#callee>["foo.mlir":2:4] at fused<#sp0>["foo.mlir":28:5])) llvm.return } loc(fused<#sp0>["foo.mlir":1:1]) // CHECK: define void @empty_types() !dbg ![[EMPTY_TYPES_LOC:[0-9]+]] llvm.func @empty_types() { llvm.return } loc(fused<#sp1>["foo.mlir":2:1]) // CHECK: ![[CU_LOC:.*]] = distinct !DICompileUnit(language: DW_LANG_C, file: ![[CU_FILE_LOC:.*]], producer: "MLIR", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "test.dwo", emissionKind: FullDebug, debugInfoForProfiling: true, nameTableKind: None) // CHECK: ![[CU_FILE_LOC]] = !DIFile(filename: "foo.mlir", directory: "/test/") // CHECK: ![[FUNC_LOC]] = distinct !DISubprogram(name: "func_with_debug", linkageName: "func_with_debug", scope: ![[NESTED_NAMESPACE:.*]], file: ![[CU_FILE_LOC]], line: 3, type: ![[FUNC_TYPE:.*]], scopeLine: 3, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: ![[CU_LOC]]) // CHECK: ![[NESTED_NAMESPACE]] = !DINamespace(name: "nested", scope: ![[TOPLEVEL_NAMESPACE:.*]]) // CHECK: ![[TOPLEVEL_NAMESPACE]] = !DINamespace(name: "toplevel", scope: null, exportSymbols: true) // CHECK: ![[FUNC_TYPE]] = !DISubroutineType(cc: DW_CC_normal, types: ![[FUNC_ARGS:.*]]) // CHECK: ![[FUNC_ARGS]] = !{null, ![[ARG_TYPE:.*]], ![[PTR_TYPE:.*]], ![[NAMED_TYPE:.*]], ![[PTR_WITH_ADDR_SPACE:.*]], ![[PTR_WITH_FILE_LINE_SCOPE:.*]], ![[FLAGS:.*]], ![[COMPOSITE_TYPE:.*]], ![[VECTOR_TYPE:.*]]} // CHECK: ![[ARG_TYPE]] = !DIBasicType() // CHECK: ![[PTR_TYPE]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[BASE_TYPE:.*]], size: 64, align: 32, offset: 8, extraData: ![[BASE_TYPE]]) // CHECK: ![[BASE_TYPE]] = !DIBasicType(name: "si32", size: 32, encoding: DW_ATE_signed) // CHECK: ![[NAMED_TYPE]] = !DIDerivedType(tag: DW_TAG_pointer_type, name: "named", baseType: ![[BASE_TYPE:.*]]) // CHECK: ![[PTR_WITH_ADDR_SPACE]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[BASE_TYPE:.*]], size: 64, align: 32, offset: 8, dwarfAddressSpace: 3) // CHECK: ![[PTR_WITH_FILE_LINE_SCOPE]] = !DIDerivedType(tag: DW_TAG_pointer_type, scope: ![[CU_FILE_LOC:.*]], file: ![[CU_FILE_LOC]], line: 42, baseType: ![[BASE_TYPE:.*]]) // CHECK: ![[FLAGS]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[BASE_TYPE:.*]], size: 64, flags: DIFlagArtificial | DIFlagObjectPointer) // CHECK: ![[COMPOSITE_TYPE]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "composite", file: ![[CU_FILE_LOC]], line: 42, size: 64, align: 32, elements: ![[COMPOSITE_ELEMENTS:.*]]) // CHECK: ![[COMPOSITE_ELEMENTS]] = !{![[COMPOSITE_ELEMENT:.*]]} // CHECK: ![[COMPOSITE_ELEMENT]] = !DISubrange(count: 4) // CHECK: ![[VECTOR_TYPE]] = !DICompositeType(tag: DW_TAG_array_type, name: "array", file: ![[CU_FILE_LOC]], baseType: ![[ARG_TYPE]], flags: DIFlagVector, elements: ![[VECTOR_ELEMENTS:.*]]) // CHECK: ![[VECTOR_ELEMENTS]] = !{![[VECTOR_ELEMENT:.*]]} // CHECK: ![[VECTOR_ELEMENT]] = !DISubrange(lowerBound: 0, upperBound: 4, stride: 1) // CHECK: ![[VAR_LOC]] = !DILocalVariable(name: "arg", arg: 1, scope: ![[VAR_SCOPE:.*]], file: ![[CU_FILE_LOC]], line: 6, type: ![[ARG_TYPE]], align: 32) // CHECK: ![[VAR_SCOPE]] = distinct !DILexicalBlockFile(scope: ![[FUNC_LOC]], file: ![[CU_FILE_LOC]], discriminator: 0) // CHECK: ![[ADDR_LOC]] = !DILocalVariable(name: "alloc", scope: ![[BLOCK_LOC:.*]]) // CHECK: ![[BLOCK_LOC]] = distinct !DILexicalBlock(scope: ![[FUNC_LOC]]) // CHECK: ![[NO_NAME_VAR]] = !DILocalVariable(scope: ![[BLOCK_LOC]]) // CHECK-DAG: ![[MY_SOURCE_LOC]] = !DILocation(line: 5, column: 6 // CHECK-DAG: ![[FILE_LOC]] = !DILocation(line: 1, column: 2, // CHECK-DAG: ![[NAMED_LOC]] = !DILocation(line: 10, column: 10 // CHECK-DAG: ![[FUSED_LOC]] = !DILocation(line: 1, column: 1 // CHECK: ![[FUSEDWITH_LOC]] = !DILocation(line: 2, column: 4, scope: ![[CALLEE_LOC:.*]], inlinedAt: ![[INLINE_LOC:.*]]) // CHECK: ![[CALLEE_LOC]] = distinct !DISubprogram(name: "callee", scope: ![[COMPOSITE_TYPE]], file: ![[CU_FILE_LOC]], type: ![[CALLEE_TYPE:.*]], spFlags: DISPFlagDefinition, unit: ![[CU_LOC]]) // CHECK: ![[CALLEE_TYPE]] = !DISubroutineType(types: ![[CALLEE_ARGS:.*]]) // CHECK: ![[CALLEE_ARGS]] = !{![[ARG_TYPE:.*]], ![[ARG_TYPE:.*]]} // CHECK: ![[INLINE_LOC]] = !DILocation(line: 28, column: 5, // CHECK: ![[EMPTY_TYPES_LOC]] = distinct !DISubprogram(name: "empty_types", scope: ![[MODULE:.*]], file: ![[CU_FILE_LOC]], type: ![[EMPTY_TYPES_TYPE:.*]], spFlags: DISPFlagDefinition, unit: ![[CU_LOC]], annotations: ![[ANNOTATIONS:.*]]) // CHECK: ![[MODULE]] = !DIModule(scope: ![[CU_FILE_LOC]], name: "module", configMacros: "bar", includePath: "/", apinotes: "/", file: ![[CU_FILE_LOC]], line: 42, isDecl: true) // CHECK: ![[EMPTY_TYPES_TYPE]] = !DISubroutineType(cc: DW_CC_normal, types: ![[EMPTY_TYPES_ARGS:.*]]) // CHECK: ![[EMPTY_TYPES_ARGS]] = !{} // CHECK: ![[ANNOTATIONS]] = !{![[ANNOTATION:.*]]} // CHECK: ![[ANNOTATION]] = !{!"foo", !"bar"} // ----- #di_file = #llvm.di_file<"foo.mlir" in "/test/"> #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #di_subprogram = #llvm.di_subprogram< scope = #di_file, name = "func_decl_with_subprogram", file = #di_file, type = #void_type > // CHECK-LABEL: declare !dbg // CHECK-SAME: ![[SUBPROGRAM:.*]] i32 @func_decl_with_subprogram( llvm.func @func_decl_with_subprogram() -> (i32) loc(fused<#di_subprogram>["foo.mlir":2:1]) // CHECK: ![[SUBPROGRAM]] = !DISubprogram(name: "func_decl_with_subprogram", scope: ![[FILE:.*]], file: ![[FILE]], type: ![[TYPE:.*]], spFlags: 0) // CHECK: ![[FILE]] = !DIFile(filename: "foo.mlir", directory: "/test/") // CHECK: ![[TYPE]] = !DISubroutineType // ----- #di_basic_type = #llvm.di_basic_type #di_file = #llvm.di_file<"foo.mlir" in "/test/"> #di_compile_unit = #llvm.di_compile_unit< id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #di_file, producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true > #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #di_subprogram = #llvm.di_subprogram< compileUnit = #di_compile_unit, scope = #di_file, name = "outer_func", file = #di_file, subprogramFlags = "Definition|Optimized", type = #void_type > #di_subprogram1 = #llvm.di_subprogram< compileUnit = #di_compile_unit, scope = #di_file, name = "inner_func", file = #di_file, subprogramFlags = "LocalToUnit|Definition|Optimized", type = #void_type > #di_local_variable0 = #llvm.di_local_variable #di_lexical_block_file = #llvm.di_lexical_block_file #di_local_variable1 = #llvm.di_local_variable #di_label = #llvm.di_label #loc0 = loc("foo.mlir":0:0) #loc1 = loc(callsite(fused<#di_lexical_block_file>[#loc0] at fused<#di_subprogram>["foo.mlir":4:2])) // CHECK-LABEL: define i32 @func_with_inlined_dbg_value( // CHECK-SAME: i32 %[[ARG:.*]]) !dbg ![[OUTER_FUNC:[0-9]+]] llvm.func @func_with_inlined_dbg_value(%arg0: i32) -> (i32) { // RECORDS: #dbg_value(i32 %[[ARG]], ![[VAR_LOC0:[0-9]+]], !DIExpression(), ![[DBG_LOC0:.*]]) llvm.intr.dbg.value #di_local_variable0 = %arg0 : i32 loc(fused<#di_subprogram>[#loc0]) // RECORDS: #dbg_value(i32 %[[ARG]], ![[VAR_LOC1:[0-9]+]], !DIExpression(), ![[DBG_LOC1:.*]]) llvm.intr.dbg.value #di_local_variable1 = %arg0 : i32 loc(#loc1) // RECORDS: #dbg_label(![[LABEL:[0-9]+]], ![[DBG_LOC1:.*]]) llvm.intr.dbg.label #di_label loc(#loc1) llvm.return %arg0 : i32 } loc(fused<#di_subprogram>["caller"]) // CHECK: ![[FILE:.*]] = !DIFile(filename: "foo.mlir", directory: "/test/") // CHECK-DAG: ![[OUTER_FUNC]] = distinct !DISubprogram(name: "outer_func", scope: ![[FILE]] // CHECK-DAG: ![[INNER_FUNC:.*]] = distinct !DISubprogram(name: "inner_func", scope: ![[FILE]] // CHECK-DAG: ![[LEXICAL_BLOCK_FILE:.*]] = distinct !DILexicalBlockFile(scope: ![[INNER_FUNC]], file: ![[FILE]], discriminator: 0) // CHECK-DAG: ![[VAR_LOC0]] = !DILocalVariable(name: "a", scope: ![[OUTER_FUNC]], file: ![[FILE]] // CHECK-DAG: ![[VAR_LOC1]] = !DILocalVariable(name: "b", scope: ![[LEXICAL_BLOCK_FILE]], file: ![[FILE]] // CHECK-DAG: ![[LABEL]] = !DILabel(scope: ![[LEXICAL_BLOCK_FILE]], name: "label", file: ![[FILE]], line: 42) // ----- #di_basic_type = #llvm.di_basic_type #di_file = #llvm.di_file<"foo.mlir" in "/test/"> #di_compile_unit = #llvm.di_compile_unit< id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #di_file, producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true > #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #di_subprogram = #llvm.di_subprogram< compileUnit = #di_compile_unit, scope = #di_file, name = "func", file = #di_file, subprogramFlags = Definition, type = #void_type> #di_local_variable = #llvm.di_local_variable #loc = loc("foo.mlir":0:0) // CHECK-LABEL: define void @func_without_subprogram( // CHECK-SAME: i32 %[[ARG:.*]]) llvm.func @func_without_subprogram(%0 : i32) { // RECORDS: #dbg_value(i32 %[[ARG]], ![[VAR_LOC:[0-9]+]], !DIExpression(), ![[DBG_LOC0:.*]]) llvm.intr.dbg.value #di_local_variable = %0 : i32 loc(fused<#di_subprogram>[#loc]) llvm.return } // CHECK: ![[FILE:.*]] = !DIFile(filename: "foo.mlir", directory: "/test/") // CHECK-DAG: ![[FUNC:.*]] = distinct !DISubprogram(name: "func", scope: ![[FILE]] // CHECK-DAG: ![[VAR_LOC]] = !DILocalVariable(name: "a", scope: ![[FUNC]], file: ![[FILE]] // ----- // Ensures that debug intrinsics without a valid location are not exported to // avoid broken LLVM IR. #di_file = #llvm.di_file<"foo.mlir" in "/test/"> #di_compile_unit = #llvm.di_compile_unit< id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #di_file, producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true > #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #di_subprogram = #llvm.di_subprogram< compileUnit = #di_compile_unit, scope = #di_file, name = "outer_func", file = #di_file, subprogramFlags = "Definition|Optimized", type = #void_type > #di_local_variable = #llvm.di_local_variable #declared_var = #llvm.di_local_variable #di_label = #llvm.di_label // CHECK-LABEL: define i32 @dbg_intrinsics_with_no_location( llvm.func @dbg_intrinsics_with_no_location(%arg0: i32) -> (i32) { %allocCount = llvm.mlir.constant(1 : i32) : i32 %alloc = llvm.alloca %allocCount x i64 : (i32) -> !llvm.ptr // RECORDS-NOT: #dbg_value llvm.intr.dbg.value #di_local_variable = %arg0 : i32 // RECORDS-NOT: #dbg_declare llvm.intr.dbg.declare #declared_var = %alloc : !llvm.ptr // RECORDS-NOT: #dbg_label llvm.intr.dbg.label #di_label llvm.return %arg0 : i32 } // ----- // CHECK: @global_with_expr_1 = external global i64, !dbg {{.*}} // CHECK: @global_with_expr_2 = external global i64, !dbg {{.*}} // CHECK-DAG: !llvm.module.flags = !{{{.*}}} // CHECK-DAG: !llvm.dbg.cu = !{{{.*}}} // CHECK-DAG: ![[FILE:.*]] = !DIFile(filename: "not", directory: "existence") // CHECK-DAG: ![[TYPE:.*]] = !DIBasicType(name: "uint64_t", size: 64, encoding: DW_ATE_unsigned) // CHECK-DAG: ![[SCOPE:.*]] = distinct !DICompileUnit(language: DW_LANG_C, file: ![[FILE]], producer: "MLIR", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: ![[GVALS:.*]], debugInfoForProfiling: true) // CHECK-DAG: ![[GVAR0:.*]] = distinct !DIGlobalVariable(name: "global_with_expr_1", linkageName: "global_with_expr_1", scope: ![[SCOPE]], file: ![[FILE]], line: 370, type: ![[TYPE]], isLocal: false, isDefinition: false) // CHECK-DAG: ![[GVAR1:.*]] = distinct !DIGlobalVariable(name: "global_with_expr_2", linkageName: "global_with_expr_2", scope: ![[SCOPE]], file: ![[FILE]], line: 371, type: ![[TYPE]], isLocal: true, isDefinition: true, align: 8) // CHECK-DAG: ![[GEXPR0:.*]] = !DIGlobalVariableExpression(var: ![[GVAR0]], expr: !DIExpression()) // CHECK-DAG: ![[GEXPR1:.*]] = !DIGlobalVariableExpression(var: ![[GVAR1]], expr: !DIExpression()) // CHECK-DAG: ![[GVALS]] = !{![[GEXPR0]], ![[GEXPR1]]} #di_file_2 = #llvm.di_file<"not" in "existence"> #di_compile_unit_2 = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #di_file_2, producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true> #di_basic_type_2 = #llvm.di_basic_type llvm.mlir.global external @global_with_expr_1() {addr_space = 0 : i32, dbg_exprs = [#llvm.di_global_variable_expression, expr = <>>]} : i64 llvm.mlir.global external @global_with_expr_2() {addr_space = 0 : i32, dbg_exprs = [#llvm.di_global_variable_expression, expr = <>>]} : i64 // ----- // CHECK: @module_global = external global i64, !dbg {{.*}} // CHECK-DAG: !llvm.module.flags = !{{{.*}}} // CHECK-DAG: !llvm.dbg.cu = !{{{.*}}} // CHECK-DAG: ![[FILE:.*]] = !DIFile(filename: "test.f90", directory: "existence") // CHECK-DAG: ![[TYPE:.*]] = !DIBasicType(name: "integer", size: 64, encoding: DW_ATE_signed) // CHECK-DAG: ![[SCOPE:.*]] = distinct !DICompileUnit(language: DW_LANG_Fortran95, file: ![[FILE]], producer: "MLIR", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: ![[GVALS:.*]], debugInfoForProfiling: true) // CHECK-DAG: ![[SCOPE1:.*]] = !DIModule(scope: ![[SCOPE]], name: "module2", file: ![[FILE]], line: 120) // CHECK-DAG: ![[GVAR:.*]] = distinct !DIGlobalVariable(name: "module_global", linkageName: "module_global", scope: ![[SCOPE1]], file: ![[FILE]], line: 121, type: ![[TYPE]], isLocal: false, isDefinition: true) // CHECK-DAG: ![[GEXPR:.*]] = !DIGlobalVariableExpression(var: ![[GVAR]], expr: !DIExpression()) // CHECK-DAG: ![[GVALS]] = !{![[GEXPR]]} #di_file = #llvm.di_file<"test.f90" in "existence"> #di_compile_unit = #llvm.di_compile_unit, sourceLanguage = DW_LANG_Fortran95, file = #di_file, producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true> #di_basic_type = #llvm.di_basic_type #di_module = #llvm.di_module llvm.mlir.global external @module_global() {dbg_exprs = [#llvm.di_global_variable_expression, expr = <>>]} : i64 // ----- // CHECK: @func_global = external global i64, !dbg {{.*}} // CHECK-DAG: ![[CU:.*]] = distinct !DICompileUnit({{.*}}globals: ![[GVALS:[0-9]+]], debugInfoForProfiling: true) // CHECK-DAG: ![[SP:.*]] = distinct !DISubprogram(name: "fn_with_gl"{{.*}}unit: ![[CU]]) // CHECK-DAG: ![[GVAR:.*]] = distinct !DIGlobalVariable(name: "func_global"{{.*}}, scope: ![[SP]]{{.*}}) // CHECK-DAG: ![[GEXPR:.*]] = !DIGlobalVariableExpression(var: ![[GVAR]], expr: !DIExpression()) // CHECK-DAG: ![[GVALS]] = !{![[GEXPR]]} #file = #llvm.di_file<"test.f90" in "existence"> #cu = #llvm.di_compile_unit, sourceLanguage = DW_LANG_Fortran95, file = #file, producer = "MLIR", isOptimized = true, emissionKind = Full, isDebugInfoForProfiling = true> #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #ty1 = #llvm.di_basic_type #sp = #llvm.di_subprogram llvm.mlir.global @func_global() {dbg_exprs = [#llvm.di_global_variable_expression, expr = <>>]} : i64 llvm.func @fn_with_gl() { llvm.return } loc(fused<#sp>["foo1.mlir":0:0]) // ----- // Test that imported entries correctly generates 'retainedNodes' in the // subprogram. llvm.func @imp_fn() { llvm.return } loc(#loc2) #di_file = #llvm.di_file<"test.f90" in ""> #di_subroutine_type = #llvm.di_subroutine_type #di_compile_unit = #llvm.di_compile_unit, sourceLanguage = DW_LANG_Fortran95, file = #di_file, isOptimized = false, emissionKind = Full, isDebugInfoForProfiling = false> #di_module_1 = #llvm.di_module #di_module_2 = #llvm.di_module #di_subprogram_self_rec = #llvm.di_subprogram> #di_imported_entity_1 = #llvm.di_imported_entity #di_imported_entity_2 = #llvm.di_imported_entity #di_subprogram = #llvm.di_subprogram, recId = distinct[1]<>, compileUnit = #di_compile_unit, scope = #di_file, name = "imp_fn", file = #di_file, subprogramFlags = Definition, type = #di_subroutine_type, retainedNodes = [#di_imported_entity_1, #di_imported_entity_2]> #loc1 = loc("test.f90":12:14) #loc2 = loc(fused<#di_subprogram>[#loc1]) // CHECK-DAG: ![[SP:[0-9]+]] = {{.*}}!DISubprogram(name: "imp_fn"{{.*}}retainedNodes: ![[NODES:[0-9]+]]) // CHECK-DAG: ![[NODES]] = !{![[NODE1:[0-9]+]], ![[NODE2:[0-9]+]]} // CHECK-DAG: ![[NODE1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: ![[SP]], entity: ![[MOD1:[0-9]+]]{{.*}}) // CHECK-DAG: ![[NODE2]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: ![[SP]], entity: ![[MOD2:[0-9]+]]{{.*}}) // CHECK-DAG: ![[MOD1]] = !DIModule({{.*}}name: "mod1"{{.*}}) // CHECK-DAG: ![[MOD2]] = !DIModule({{.*}}name: "mod2"{{.*}}) // ----- // Nameless and scopeless global constant. // CHECK-LABEL: @.str.1 = external constant [10 x i8] // CHECK-SAME: !dbg ![[GLOBAL_VAR_EXPR:.*]] // CHECK-DAG: ![[GLOBAL_VAR_EXPR]] = !DIGlobalVariableExpression(var: ![[GLOBAL_VAR:.*]], expr: !DIExpression()) // CHECK-DAG: ![[GLOBAL_VAR]] = distinct !DIGlobalVariable(scope: null, file: !{{[0-9]+}}, line: 268, type: !{{[0-9]+}}, isLocal: true, isDefinition: true) #di_basic_type = #llvm.di_basic_type #di_file = #llvm.di_file<"file.c" in "/path/to/file"> #di_derived_type = #llvm.di_derived_type #di_composite_type = #llvm.di_composite_type #di_global_variable = #llvm.di_global_variable #di_global_variable_expression = #llvm.di_global_variable_expression> llvm.mlir.global external constant @".str.1"() {addr_space = 0 : i32, dbg_exprs = [#di_global_variable_expression]} : !llvm.array<10 x i8> // ----- // CHECK-DAG: ![[FILE1:.*]] = !DIFile(filename: "foo1.mlir", directory: "/test/") #di_file_1 = #llvm.di_file<"foo1.mlir" in "/test/"> // CHECK-DAG: ![[FILE2:.*]] = !DIFile(filename: "foo2.mlir", directory: "/test/") #di_file_2 = #llvm.di_file<"foo2.mlir" in "/test/"> // CHECK-DAG: ![[SCOPE2:.*]] = distinct !DICompileUnit(language: DW_LANG_C, file: ![[FILE2]], producer: "MLIR", isOptimized: true, runtimeVersion: 0, emissionKind: DebugDirectivesOnly, debugInfoForProfiling: true) #di_compile_unit_1 = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #di_file_1, producer = "MLIR", isOptimized = true, emissionKind = LineTablesOnly, isDebugInfoForProfiling = true> // CHECK-DAG: ![[SCOPE1:.*]] = distinct !DICompileUnit(language: DW_LANG_C, file: ![[FILE1]], producer: "MLIR", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, debugInfoForProfiling: true) #di_compile_unit_2 = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #di_file_2, producer = "MLIR", isOptimized = true, emissionKind = DebugDirectivesOnly, isDebugInfoForProfiling = true> #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #di_subprogram_1 = #llvm.di_subprogram #di_subprogram_2 = #llvm.di_subprogram llvm.func @func_line_tables() { llvm.return } loc(fused<#di_subprogram_1>["foo1.mlir":0:0]) llvm.func @func_debug_directives() { llvm.return } loc(fused<#di_subprogram_2>["foo2.mlir":0:0]) // ----- // Ensure recursive types with multiple external references work. // Common base nodes. #di_file = #llvm.di_file<"test.mlir" in "/"> #di_null_type = #llvm.di_null_type #di_compile_unit = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #di_file, isOptimized = false, emissionKind = None, isDebugInfoForProfiling = false> // Recursive type itself. #di_struct_self = #llvm.di_composite_type, isRecSelf = true> #di_ptr_inner = #llvm.di_derived_type #di_subroutine_inner = #llvm.di_subroutine_type #di_subprogram_inner = #llvm.di_subprogram< id = distinct[2]<>, compileUnit = #di_compile_unit, scope = #di_struct_self, name = "class_method", file = #di_file, subprogramFlags = Definition, type = #di_subroutine_inner> #di_struct = #llvm.di_composite_type< tag = DW_TAG_class_type, recId = distinct[0]<>, name = "class_name", file = #di_file, line = 42, flags = "TypePassByReference|NonTrivial", elements = #di_subprogram_inner> // Outer types referencing the entire recursive type. #di_ptr_outer = #llvm.di_derived_type #di_subroutine_outer = #llvm.di_subroutine_type #di_subprogram_outer = #llvm.di_subprogram< id = distinct[2]<>, compileUnit = #di_compile_unit, scope = #di_struct, name = "class_method", file = #di_file, subprogramFlags = Definition, type = #di_subroutine_outer> #loc3 = loc(fused<#di_subprogram_outer>["test.mlir":1:1]) // CHECK: @class_method // CHECK: ret void, !dbg ![[LOC:.*]] // CHECK: ![[CU:.*]] = distinct !DICompileUnit( // CHECK: ![[SP:.*]] = distinct !DISubprogram(name: "class_method", scope: ![[STRUCT:.*]], file: !{{.*}}, type: ![[SUBROUTINE:.*]], spFlags: DISPFlagDefinition, unit: ![[CU]]) // CHECK: ![[STRUCT]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "class_name", {{.*}}, elements: ![[ELEMS:.*]]) // CHECK: ![[ELEMS]] = !{![[SP]]} // CHECK: ![[SUBROUTINE]] = !DISubroutineType(types: ![[SUBROUTINE_ELEMS:.*]]) // CHECK: ![[SUBROUTINE_ELEMS]] = !{null, ![[PTR:.*]]} // CHECK: ![[PTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[STRUCT]], size: 64) // CHECK: ![[LOC]] = !DILocation(line: 1, column: 1, scope: ![[SP]]) llvm.func @class_method() { llvm.return loc(#loc3) } loc(#loc3) // ----- // Ensures composite types with a recursive scope work. #di_composite_type_self = #llvm.di_composite_type, isRecSelf = true> #di_file = #llvm.di_file<"test.mlir" in "/"> #di_subroutine_type = #llvm.di_subroutine_type #di_subprogram = #llvm.di_subprogram #di_composite_type = #llvm.di_composite_type, scope = #di_subprogram> #di_global_variable = #llvm.di_global_variable #di_global_variable_expression = #llvm.di_global_variable_expression llvm.mlir.global @global_variable() {dbg_exprs = [#di_global_variable_expression]} : !llvm.struct<()> // CHECK: distinct !DIGlobalVariable({{.*}}type: ![[COMP:[0-9]+]], // CHECK: ![[COMP]] = distinct !DICompositeType({{.*}}scope: ![[SCOPE:[0-9]+]] // CHECK: ![[SCOPE]] = !DISubprogram({{.*}}type: ![[SUBROUTINE:[0-9]+]], // CHECK: ![[SUBROUTINE]] = !DISubroutineType(types: ![[SR_TYPES:[0-9]+]]) // CHECK: ![[SR_TYPES]] = !{![[COMP]]} // ----- // Ensures nested recursive decls work. // The output should be identical to if the inner composite type decl was // replaced with the recursive self reference. #di_file = #llvm.di_file<"test.mlir" in "/"> #di_composite_type_self = #llvm.di_composite_type, isRecSelf = true> #di_subroutine_type_inner = #llvm.di_subroutine_type #di_subprogram_inner = #llvm.di_subprogram #di_composite_type_inner = #llvm.di_composite_type, scope = #di_subprogram_inner> #di_subroutine_type = #llvm.di_subroutine_type #di_subprogram = #llvm.di_subprogram #di_composite_type = #llvm.di_composite_type, scope = #di_subprogram> // Use the inner type standalone outside too. Ensures it's not cached wrong. #di_var_type = #llvm.di_subroutine_type #di_global_variable = #llvm.di_global_variable #di_global_variable_expression = #llvm.di_global_variable_expression llvm.mlir.global @global_variable() {dbg_exprs = [#di_global_variable_expression]} : !llvm.struct<()> // CHECK: distinct !DIGlobalVariable({{.*}}type: ![[VAR:[0-9]+]], // CHECK: ![[VAR]] = !DISubroutineType(types: ![[COMPS:[0-9]+]]) // CHECK: ![[COMPS]] = !{![[COMP:[0-9]+]], // CHECK: ![[COMP]] = distinct !DICompositeType({{.*}}scope: ![[SCOPE:[0-9]+]] // CHECK: ![[SCOPE]] = !DISubprogram({{.*}}type: ![[SUBROUTINE:[0-9]+]], // CHECK: ![[SUBROUTINE]] = !DISubroutineType(types: ![[SR_TYPES:[0-9]+]]) // CHECK: ![[SR_TYPES]] = !{![[COMP]]} // ----- #file = #llvm.di_file<"test.f90" in ""> #cu = #llvm.di_compile_unit, sourceLanguage = DW_LANG_Fortran95, file = #file, producer = "", isOptimized = false, emissionKind = Full, isDebugInfoForProfiling = false> #i32 = #llvm.di_basic_type< tag = DW_TAG_base_type, name = "integer", sizeInBits = 32, encoding = DW_ATE_signed > #null = #llvm.di_null_type #alloc = #llvm.di_expression<[DW_OP_lit0, DW_OP_ne]> #assoc = #llvm.di_expression<[DW_OP_lit0, DW_OP_eq]> #rank = #llvm.di_expression<[DW_OP_push_object_address, DW_OP_plus_uconst(16), DW_OP_deref]> #datal = #llvm.di_expression<[DW_OP_push_object_address, DW_OP_deref]> #array = #llvm.di_composite_type > #spType0 = #llvm.di_subroutine_type #sp0 = #llvm.di_subprogram< compileUnit = #cu, scope = #cu, name = "fn_with_composite", file = #file, subprogramFlags = "Definition|Optimized", type = #spType0 > llvm.func @fn_with_composite() { llvm.return }loc(fused<#sp0>["foo.mlir":1:1]) // CHECK-LABEL: define void @fn_with_composite() // CHECK: !DICompositeType( // CHECK-SAME: dataLocation: !DIExpression(DW_OP_push_object_address, DW_OP_deref) // CHECK-SAME: associated: !DIExpression(DW_OP_lit0, DW_OP_eq) // CHECK-SAME: allocated: !DIExpression(DW_OP_lit0, DW_OP_ne) // CHECK-SAME: rank: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 16, DW_OP_deref) // ----- // Test that Subrange/generic_subrange works with expression and variables. #bt = #llvm.di_basic_type #file = #llvm.di_file<"debug-info.ll" in "/"> #cu = #llvm.di_compile_unit, sourceLanguage = DW_LANG_Fortran95, file = #file, isOptimized = false, emissionKind = Full, isDebugInfoForProfiling = false> #exp1 = #llvm.di_expression<[DW_OP_push_object_address, DW_OP_plus_uconst(16), DW_OP_deref]> #comp_ty1 = #llvm.di_composite_type> #exp2 = #llvm.di_expression<[DW_OP_push_object_address, DW_OP_plus_uconst(24), DW_OP_deref]> #exp3 = #llvm.di_expression<[DW_OP_push_object_address, DW_OP_plus_uconst(32), DW_OP_deref]> #comp_ty2 = #llvm.di_composite_type> #srty = #llvm.di_subroutine_type #sp = #llvm.di_subprogram #lvar = #llvm.di_local_variable #gv = #llvm.di_global_variable #gve = #llvm.di_global_variable_expression> #comp_ty3 = #llvm.di_composite_type> #comp_ty4 = #llvm.di_composite_type> #lvar2 = #llvm.di_local_variable #lvar3 = #llvm.di_local_variable #loc1 = loc("test.f90": 1:1) #loc2 = loc(fused<#sp>[#loc1]) llvm.mlir.global external @gv() {dbg_exprs = [#gve]} : i64 llvm.func @subranges(%arg: !llvm.ptr) { llvm.intr.dbg.declare #lvar2 = %arg : !llvm.ptr llvm.intr.dbg.declare #lvar3 = %arg : !llvm.ptr llvm.return } loc(#loc2) // CHECK-LABEL: define void @subranges // CHECK: ![[GV:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "gv"{{.*}}) // CHECK: !DICompositeType(tag: DW_TAG_array_type, name: "expr_elements"{{.*}}elements: ![[ELEMENTS1:[0-9]+]]) // CHECK: ![[ELEMENTS1]] = !{![[ELEMENT1:[0-9]+]]} // CHECK: ![[ELEMENT1]] = !DISubrange(count: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 16, DW_OP_deref)) // CHECK: !DICompositeType(tag: DW_TAG_array_type, name: "expr_elements2"{{.*}}elements: ![[GSR_ELEMS:[0-9]+]]) // CHECK: ![[GSR_ELEMS]] = !{![[GSR_ELEM:[0-9]+]]} // CHECK: ![[GSR_ELEM]] = !DIGenericSubrange(count: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 16, DW_OP_deref) // CHECK-SAME: lowerBound: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 24, DW_OP_deref) // CHECK-SAME: stride: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 32, DW_OP_deref) // CHECK: !DICompositeType(tag: DW_TAG_array_type, name: "var_elements"{{.*}}elements: ![[ELEMENTS2:[0-9]+]]) // CHECK: ![[ELEMENTS2]] = !{![[ELEMENT2:[0-9]+]]} // CHECK: ![[ELEMENT2]] = !DISubrange(count: ![[LV:[0-9]+]], stride: ![[GV]]) // CHECK: ![[LV]] = !DILocalVariable(name: "size"{{.*}}) // CHECK: !DICompositeType(tag: DW_TAG_array_type, name: "var_elements2", baseType: !{{.*}}, elements: ![[GSR_ELEMS2:[0-9]+]]) // CHECK: ![[GSR_ELEMS2]] = !{![[GSR_ELEM2:[0-9]+]]} // CHECK: ![[GSR_ELEM2]] = !DIGenericSubrange(count: ![[LV]], lowerBound: ![[GV]], stride: ![[GV]]) // ----- #bt = #llvm.di_basic_type #file = #llvm.di_file<"debug-info.ll" in "/"> #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #cu = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #file, isOptimized = false, emissionKind = Full, isDebugInfoForProfiling = false> #sp = #llvm.di_subprogram #var = #llvm.di_local_variable #sty1 = #llvm.di_string_type, stringLocationExp = <[DW_OP_push_object_address, DW_OP_deref]>> #var1 = #llvm.di_local_variable #sty2 = #llvm.di_string_type #var2 = #llvm.di_local_variable llvm.func @string_ty(%arg0: !llvm.ptr) { llvm.intr.dbg.value #var1 = %arg0 : !llvm.ptr llvm.intr.dbg.value #var2 = %arg0 : !llvm.ptr llvm.return } loc(#loc2) #loc1 = loc("test.f90":1:1) #loc2 = loc(fused<#sp>[#loc1]) // CHECK-DAG: !DIStringType(name: "character(*)", stringLength: ![[VAR:[0-9]+]], stringLengthExpression: !DIExpression(DW_OP_push_object_address, DW_OP_plus_uconst, 8), stringLocationExpression: !DIExpression(DW_OP_push_object_address, DW_OP_deref), size: 32, align: 8) // CHECK-DAG: ![[VAR]] = !DILocalVariable(name: "string_size"{{.*}} flags: DIFlagArtificial) // CHECK-DAG: !DIStringType() // ----- // Test translation of DICommonBlockAttr. #bt = #llvm.di_basic_type #file = #llvm.di_file<"test.f90" in ""> #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #cu = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #file, isOptimized = false, emissionKind = Full, isDebugInfoForProfiling = false> #sp = #llvm.di_subprogram #di_common_block = #llvm.di_common_block #global_var = #llvm.di_global_variable #var_expression = #llvm.di_global_variable_expression> llvm.mlir.global common @block_(dense<0> : tensor<8xi8>) {dbg_exprs = [#var_expression]} : !llvm.array<8 x i8> llvm.func @test() { llvm.return } loc(#loc2) #loc1 = loc("test.f90":1:0) #loc2 = loc(fused<#sp>[#loc1]) // CHECK: !DICommonBlock(scope: ![[SCOPE:[0-9]+]], declaration: null, name: "block", file: ![[FILE:[0-9]+]], line: 3) // CHECK: ![[SCOPE]] = {{.*}}!DISubprogram(name: "test"{{.*}}) // CHECK: ![[FILE]] = !DIFile(filename: "test.f90"{{.*}}) // ----- // Test multiple DIGlobalVariableExpression on a global. #bt = #llvm.di_basic_type #file = #llvm.di_file<"test.f90" in ""> #cu = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #file, isOptimized = false, emissionKind = Full, isDebugInfoForProfiling = false> #global_var = #llvm.di_global_variable #var_expression = #llvm.di_global_variable_expression> #global_var1 = #llvm.di_global_variable #var_expression1 = #llvm.di_global_variable_expression> llvm.mlir.global @data() {dbg_exprs = [#var_expression, #var_expression1]} : i64 // CHECK: @data = external global i64, !dbg ![[EXP1:[0-9]+]], !dbg ![[EXP2:[0-9]+]] // CHECK: ![[EXP1]] = !DIGlobalVariableExpression(var: ![[VAR1:[0-9]+]], expr: !DIExpression()) // CHECK: ![[VAR1]] = {{.*}}!DIGlobalVariable(name: "a"{{.*}}) // CHECK: ![[EXP2]] = !DIGlobalVariableExpression(var: ![[VAR2:[0-9]+]], expr: !DIExpression()) // CHECK: ![[VAR2]] = {{.*}}!DIGlobalVariable(name: "b"{{.*}}) // ----- // Test lowering compile unit `importedEntities` to LLVM IR `imports`. #file = #llvm.di_file<"test.mlir" in ""> #ns = #llvm.di_namespace #ie = #llvm.di_imported_entity #cu = #llvm.di_compile_unit< id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #file, producer = "MLIR", isOptimized = false, emissionKind = Full, importedEntities = #ie > #sp_ty = #llvm.di_subroutine_type #sp = #llvm.di_subprogram< compileUnit = #cu, scope = #file, name = "fn_cu_imports", file = #file, line = 1, scopeLine = 1, subprogramFlags = Definition, type = #sp_ty > // CHECK-LABEL: define void @fn_cu_imports() llvm.func @fn_cu_imports() { llvm.return } loc(fused<#sp>["cu_imports.mlir":1:1]) // CHECK-DAG: ![[FILE:[0-9]+]] = !DIFile(filename: "test.mlir", directory: "") // CHECK-DAG: ![[NS:[0-9]+]] = !DINamespace(name: "imported_ns"{{.*}}) // CHECK-DAG: ![[IE:[0-9]+]] = !DIImportedEntity(tag: DW_TAG_imported_module{{.*}}entity: ![[NS]]{{.*}}) // CHECK-DAG: ![[IMP_LIST:[0-9]+]] = !{![[IE]]} // CHECK-DAG: !DICompileUnit({{.*}}imports: ![[IMP_LIST]]) // ----- #file = #llvm.di_file<"m.cpp" in "/"> #ns = #llvm.di_namespace #self = #llvm.di_compile_unit< recId = distinct[0]<>, isRecSelf = true, sourceLanguage = DW_LANG_C > #ie = #llvm.di_imported_entity< tag = DW_TAG_imported_module, scope = #self, entity = #ns, file = #file > #cu = #llvm.di_compile_unit< recId = distinct[0]<>, id = distinct[2]<>, sourceLanguage = DW_LANG_C, file = #file, producer = "p", isOptimized = false, emissionKind = Full, importedEntities = #ie > #sp_ty = #llvm.di_subroutine_type #sp = #llvm.di_subprogram< compileUnit = #cu, scope = #file, name = "fn_cu_import_cycle", file = #file, line = 1, scopeLine = 1, subprogramFlags = Definition, type = #sp_ty > // CHECK-LABEL: define void @fn_cu_import_cycle() llvm.func @fn_cu_import_cycle() { llvm.return } loc(fused<#sp>["m.mlir":1:1]) // CHECK-DAG: !DIImportedEntity(tag: DW_TAG_imported_module{{.*}}) // CHECK-DAG: !DICompileUnit({{.*}}imports: // ----- #di_file = #llvm.di_file<"foo.mlir" in "/tmp"> #di_cu = #llvm.di_compile_unit, sourceLanguage = DW_LANG_C, file = #di_file, isOptimized = false, emissionKind = Full> #di_uint8 = #llvm.di_basic_type #di_int64 = #llvm.di_basic_type #di_f64 = #llvm.di_basic_type #di_disc = #llvm.di_derived_type #di_arm_i = #llvm.di_derived_type #di_arm_f = #llvm.di_derived_type #di_vp = #llvm.di_composite_type #void_return = #llvm.di_null_type #void_type = #llvm.di_subroutine_type #di_sub = #llvm.di_subprogram, compileUnit = #di_cu, scope = #di_file, name = "variant_part_emission", file = #di_file, subprogramFlags = Definition, type = #void_type> #di_local = #llvm.di_local_variable #loc = loc(fused<#di_sub>["foo.mlir":1:1]) // CHECK-LABEL: define void @variant_part_emission // CHECK-DAG: !DICompositeType(tag: DW_TAG_variant_part // CHECK-SAME: identifier: "variant-id" // CHECK-SAME: discriminator: ![[DISC:[0-9]+]] // CHECK-DAG: !DIDerivedType(tag: DW_TAG_member, name: "_int64"{{.*}}extraData: i8 1) // CHECK-DAG: !DIDerivedType(tag: DW_TAG_member, name: "_float64"{{.*}}extraData: i8 2) // CHECK: ![[DISC]] = !DIDerivedType(tag: DW_TAG_member // CHECK-SAME: name: "discriminator" // CHECK-SAME: flags: DIFlagArtificial llvm.func @variant_part_emission(%arg0: i32) { llvm.intr.dbg.value #di_local = %arg0 : i32 loc(#loc) llvm.return loc(#loc) } loc(#loc)