[all-commits] [llvm/llvm-project] 5cf570: [mlir][ElementsAttr] Change value_begin_impl to tr...

Jeff Niu via All-commits all-commits at lists.llvm.org
Tue Aug 30 14:13:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5cf5708628a3a465d7845fb43e46bd7f97761ead
      https://github.com/llvm/llvm-project/commit/5cf5708628a3a465d7845fb43e46bd7f97761ead
  Author: Jeff Niu <jeff at modular.com>
  Date:   2022-08-30 (Tue, 30 Aug 2022)

  Changed paths:
    M mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/include/mlir/Support/LogicalResult.h
    M mlir/lib/IR/BuiltinAttributes.cpp
    M mlir/test/IR/elements-attr-interface.mlir
    M mlir/test/lib/Dialect/Test/TestAttrDefs.td
    M mlir/test/lib/IR/TestBuiltinAttributeInterfaces.cpp

  Log Message:
  -----------
  [mlir][ElementsAttr] Change value_begin_impl to try_value_begin_impl

This patch changes `value_begin_impl` to a faillable
`try_value_begin_impl` so that specific cases can fail iteration if the
type doesn't match the internal storage.

Reviewed By: rriddle

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


  Commit: 1c66bacd6cde1f37d6ac96c45b389666a1334ec0
      https://github.com/llvm/llvm-project/commit/1c66bacd6cde1f37d6ac96c45b389666a1334ec0
  Author: Jeff Niu <jeff at modular.com>
  Date:   2022-08-30 (Tue, 30 Aug 2022)

  Changed paths:
    M mlir/include/mlir/IR/BuiltinAttributes.h
    M mlir/include/mlir/IR/BuiltinAttributes.td
    M mlir/lib/IR/BuiltinAttributes.cpp

  Log Message:
  -----------
  [mlir] Fix try_value_begin_impl for DenseElementsAttr

The previous implementation would still crash if the element type was
not iterable. This patch changes SparseElementsAttr to properly
implement `try_value_begin_impl` according to ElementsAttr and changes
DenseElementsAttr to implement `tryGetValues` as the basis for querying
element values.

Depends on D132904

Reviewed By: rriddle

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


Compare: https://github.com/llvm/llvm-project/compare/bac3aeda0694...1c66bacd6cde


More information about the All-commits mailing list