[all-commits] [llvm/llvm-project] c48e0c: [mlir] Remove TypedAttr and ElementsAttr from Dens...

Jeff Niu via All-commits all-commits at lists.llvm.org
Mon Dec 5 13:28:09 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c48e0cf03a50bb8a2043ac4bb5e9a83ff135247a
      https://github.com/llvm/llvm-project/commit/c48e0cf03a50bb8a2043ac4bb5e9a83ff135247a
  Author: Jeff Niu <jeff at modular.com>
  Date:   2022-12-05 (Mon, 05 Dec 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/lib/AsmParser/AttributeParser.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/BuiltinAttributes.cpp
    M mlir/lib/IR/BuiltinDialectBytecode.cpp
    M mlir/test/IR/attribute.mlir
    M mlir/test/IR/elements-attr-interface.mlir
    M mlir/test/IR/invalid-builtin-attributes.mlir
    M mlir/test/lib/IR/TestBuiltinAttributeInterfaces.cpp

  Log Message:
  -----------
  [mlir] Remove TypedAttr and ElementsAttr from DenseArrayAttr

This patch removes the implementation of TypedAttr and ElementsAttr
from DenseArrayAttr and, in doing so, removes the need store a shaped
type. The attribute now stores a size (number of elements), an MLIR type
as a discriminator, and a raw byte array.

The intent of DenseArrayAttr was not to be a drop-in replacement for DenseElementsAttr. It was meant to be a simple container of integers or floats that map to C++ types. The ElementsAttr implementation on DenseArrayAttr had many holes in it, and fixing those holes would require evolving DenseArrayAttr in a way that is incompatible with its original purpose.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D137606




More information about the All-commits mailing list