@@ -423,3 +423,31 @@ llvm.mlir.global @global_variable() {dbg_expr = #di_global_variable_expression}
423
423
// CHECK: ![[SCOPE]] = !DISubprogram({{.*}}type: ![[SUBROUTINE:[0-9]+]],
424
424
// CHECK: ![[SUBROUTINE]] = !DISubroutineType(types: ![[SR_TYPES:[0-9]+]])
425
425
// CHECK: ![[SR_TYPES]] = !{![[COMP]]}
426
+
427
+ // -----
428
+
429
+ // Ensures nested recursive decls work.
430
+ // The output should be identical to if the inner composite type decl was
431
+ // replaced with the recursive self reference.
432
+
433
+ #di_file = #llvm.di_file <" test.mlir" in " /" >
434
+ #di_composite_type_self = #llvm.di_composite_type <tag = DW_TAG_null , recId = distinct [0 ]<>>
435
+
436
+ #di_subroutine_type_inner = #llvm.di_subroutine_type <types = #di_composite_type_self >
437
+ #di_subprogram_inner = #llvm.di_subprogram <scope = #di_file , file = #di_file , subprogramFlags = Optimized , type = #di_subroutine_type_inner >
438
+ #di_composite_type_inner = #llvm.di_composite_type <tag = DW_TAG_class_type , recId = distinct [0 ]<>, scope = #di_subprogram_inner >
439
+
440
+ #di_subroutine_type = #llvm.di_subroutine_type <types = #di_composite_type_inner >
441
+ #di_subprogram = #llvm.di_subprogram <scope = #di_file , file = #di_file , subprogramFlags = Optimized , type = #di_subroutine_type >
442
+ #di_composite_type = #llvm.di_composite_type <tag = DW_TAG_class_type , recId = distinct [0 ]<>, scope = #di_subprogram >
443
+
444
+ #di_global_variable = #llvm.di_global_variable <file = #di_file , line = 1 , type = #di_composite_type >
445
+ #di_global_variable_expression = #llvm.di_global_variable_expression <var = #di_global_variable >
446
+
447
+ llvm.mlir.global @global_variable () {dbg_expr = #di_global_variable_expression } : !llvm.struct <()>
448
+
449
+ // CHECK: distinct !DIGlobalVariable({{.*}}type: ![[COMP:[0-9]+]],
450
+ // CHECK: ![[COMP]] = distinct !DICompositeType({{.*}}scope: ![[SCOPE:[0-9]+]],
451
+ // CHECK: ![[SCOPE]] = !DISubprogram({{.*}}type: ![[SUBROUTINE:[0-9]+]],
452
+ // CHECK: ![[SUBROUTINE]] = !DISubroutineType(types: ![[SR_TYPES:[0-9]+]])
453
+ // CHECK: ![[SR_TYPES]] = !{![[COMP]]}
0 commit comments