================ @@ -502,6 +502,15 @@ def CIR_RecordType : CIR_Type<"Record", "record", void complete(llvm::ArrayRef<mlir::Type> members, bool packed, bool isPadded); + + // Utilities for lazily computing and cacheing data layout info. + // FIXME: currently opaque because there's a cycle if CIRTypes.types include + // from CIRAttrs.h. The implementation operates in terms of RecordLayoutAttr + // instead. + private: + mutable mlir::Attribute layoutInfo; ---------------- xlauko wrote:
Investigating this more, I don't believe this does what it is intended for. Since MLIR is heavily value-oriented `RecordType` will hold this only in "local scope" for specific instance of it. If you get to this type at different location, e.g. through dyn_cast it won't retain any of the layoutInfo, as it will be default constructed. That does not sound really useful to cache these just locally, I would suggest to have just extra methods to get specific layouInfo parameterers in such case. Also it breaks the expected bahavior that mlir values are lightweight so one can copy them freely (basically just tagged pointer to storage). https://github.com/llvm/llvm-project/pull/136036 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits