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

Abid Qadeer llvmlistbot at llvm.org
Thu May 30 04:29:59 PDT 2024


================
@@ -625,10 +625,10 @@ def LLVM_DINamespaceAttr : LLVM_Attr<"DINamespace", "di_namespace",
 def LLVM_DISubrangeAttr : LLVM_Attr<"DISubrange", "di_subrange", /*traits=*/[],
                                     "DINodeAttr"> {
   let parameters = (ins
-    OptionalParameter<"IntegerAttr">:$count,
-    OptionalParameter<"IntegerAttr">:$lowerBound,
-    OptionalParameter<"IntegerAttr">:$upperBound,
-    OptionalParameter<"IntegerAttr">:$stride
+    OptionalParameter<"::mlir::Attribute">:$count,
----------------
abidh wrote:

I could not find a simple way to add that constraint so I am open to suggestions here. My initial approach was to add a `DISubrangeValueAttr` type which has fields for all the types that we expect (e.g. `IntegerAttr`, `DIExpressionAttr`, etc). Then use that in the `DISubrangeAttr` in place of `IntegerAttr`. But it seems a bit overkill to me. Also made the usage a bit more cumbersome.

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


More information about the Mlir-commits mailing list