In LLVM there is a feature for zero-initializing aggregate types like arrays. It’s called zeroinitializer (https://llvm.org/docs/LangRef.html#complex-constants).
In my MLIR dialect I have created a tensor-like type which I use for global declarations that have common linkage (common linkage requires a zero initializer).
Is there currently a way to use the zeroinitializer feature in the LLVM MLIR dialect ?
Not directly, and it is unclear to me whether we want a cross-type zero initializer or prefer something more structured. In the meantime, it is possible to create globals filled with zeros by using attributes with splat elements attributes:
It would be a “nice to have” feature in the LLVM IR dialect if there was a direct way to be able to generate zeroinitializer for aggregates. Fortran COMMON blocks (from which the linkage name derives) would be simpler to code gen, etc.