[Mlir-commits] [mlir] [MLIR] Improve translation of DISubrange. (PR #93689)

Christian Ulmann llvmlistbot at llvm.org
Wed May 29 09:24:36 PDT 2024


================
@@ -519,3 +519,41 @@ llvm.func @fn_with_composite() {
 // 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 works with expression and variables.
+
+#di_basic_type = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "int">
+#di_file = #llvm.di_file<"debug-info.ll" in "/">
+#di_compile_unit = #llvm.di_compile_unit<id = distinct[1]<>, sourceLanguage = DW_LANG_Fortran95, file = #di_file, isOptimized = false, emissionKind = Full>
+#di_composite_type = #llvm.di_composite_type<tag = DW_TAG_array_type, name = "expr_elements", baseType = #di_basic_type, flags = Vector, elements = #llvm.di_subrange<count = #llvm.di_expression<[DW_OP_push_object_address, DW_OP_plus_uconst(16), DW_OP_deref]>>>
+#di_subroutine_type = #llvm.di_subroutine_type<types = #di_basic_type, #di_composite_type>
+#di_subprogram = #llvm.di_subprogram<id = distinct[2]<>, compileUnit = #di_compile_unit, scope = #di_file, name = "subranges", file = #di_file, subprogramFlags = Definition, type = #di_subroutine_type>
+#di_local_variable = #llvm.di_local_variable<scope = #di_subprogram, name = "size">
+#gv1 = #llvm.di_global_variable<scope = #di_compile_unit, name = "gv", file = #di_file, line = 3, type = #di_basic_type>
+#gve1 = #llvm.di_global_variable_expression<var = #gv1, expr = <>>
+#di_composite_type1 = #llvm.di_composite_type<tag = DW_TAG_array_type, name = "var_elements", baseType = #di_basic_type, flags = Vector, elements = #llvm.di_subrange<count = #di_local_variable, stride = #gv1>>
+#di_local_variable1 = #llvm.di_local_variable<scope = #di_subprogram, name = "size", type = #di_composite_type1>
+#loc1 = loc("test.f90": 1:1)
+#loc2 = loc(fused<#di_subprogram>[#loc1])
----------------
Dinistro wrote:

Are all of these attribute parameters required?
Also, can you try to split the attributes over different lines (as for the first test in this file), to ensure this is somewhat in the 80 lines character limit (which is not properly enforced in this file).

https://github.com/llvm/llvm-project/pull/93689


More information about the Mlir-commits mailing list