[Mlir-commits] [mlir] [mlir][LLVM] handle ArrayAttr for constant array of structs (PR #139724)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed May 14 02:46:24 PDT 2025
jeanPerier wrote:
> Do you need the full flexibility of this PR or are you mainly interested in a solution of arrays of structs? If it is the later, I would favor making the PR more restrictive to only support what we need.
Thanks for the review! Yes that is my use case (the array potentially being nested 2 or more times: `[1000 x [50 x %STRUCT]] `), the struct type containing any element from int, float, pointers, struct, or arrays (potentially of struct themselves).
Here is an example of a more complex struct type for which I want to use attributes instead of insert chains when creating initializers for array of that type: `%STRUCT = type { { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } }`.
By more restrictive, do you mean rejecting the ArrayAttr on an mlir::Constant for an array whose element is not a struct type?
I did not do it because although the ModuleTranslation did not support it, the verifier was already accepting those, so I wondered if someone had a use case for that purely in the LLVM MLIR dialect. I am ok with rejecting it if you think that is not needed.
I am open to alternatives if you see a better path for my goal.
https://github.com/llvm/llvm-project/pull/139724
More information about the Mlir-commits
mailing list