Changes

Summary

  1. [InstCombine] Eliminate vector reverse if all inputs/outputs to an instruction are reverses (details)
  2. [mlir][python] Forward _OperationBase _CAPIPtr to the Operation. (details)
  3. [mlir] Tighten verification of SparseElementsAttr (details)
  4. [mlir] Add value_begin/value_end methods to DenseElementsAttr (details)
  5. [mlir] Refactor ElementsAttr into an AttrInterface (details)
  6. [llvm] Use make_early_inc_range (NFC) (details)
Commit f417d9d821118ef330b263c4c7ad9d3cda30f406 by mnadeem
[InstCombine] Eliminate vector reverse if all inputs/outputs to an instruction are reverses

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

Change-Id: I1a10d2bc33acbe0ea353c6cb3d077851391fe73e
The file was modifiedllvm/test/Transforms/LoopVectorize/AArch64/sve-vector-reverse-mask4.ll
The file was modifiedllvm/test/Transforms/LoopVectorize/AArch64/sve-vector-reverse.ll
The file was addedllvm/test/Transforms/InstCombine/vector-reverse.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
Commit 1fb2e842a93ac862849f5081eb6fdf6f1447ef2a by stellaraccident
[mlir][python] Forward _OperationBase _CAPIPtr to the Operation.

* ODS generated operations extend _OperationBase and without this, cannot be marshalled to CAPI functions.
* No test case updates: this kind of interop is quite hard to verify with in-tree tests.

Differential Revision: https://reviews.llvm.org/D110030
The file was modifiedmlir/lib/Bindings/Python/IRCore.cpp
Commit 4f21152af12b21ea8f04b322a29dc6ad9e79ef16 by riddleriver
[mlir] Tighten verification of SparseElementsAttr

SparseElementsAttr currently does not perform any verfication on construction, with the only verification existing within the parser. This revision moves the parser verification to SparseElementsAttr, and also adds additional verification for when a sparse index is not valid.

Differential Revision: https://reviews.llvm.org/D109189
The file was modifiedmlir/test/Dialect/Quant/convert-const.mlir
The file was modifiedmlir/test/IR/parser.mlir
The file was modifiedmlir/test/IR/invalid.mlir
The file was modifiedmlir/test/IR/pretty-attributes.mlir
The file was modifiedmlir/lib/Parser/TypeParser.cpp
The file was modifiedmlir/test/CAPI/ir.c
The file was modifiedmlir/lib/Parser/Parser.h
The file was modifiedmlir/test/Dialect/Tensor/canonicalize.mlir
The file was modifiedmlir/test/Target/LLVMIR/llvmir.mlir
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.h
The file was modifiedmlir/lib/Parser/AttributeParser.cpp
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.td
The file was modifiedmlir/lib/IR/BuiltinAttributes.cpp
Commit 0cb5d7fc7fd3eeb40b6ecf9b34a497d46bcba6c6 by riddleriver
[mlir] Add value_begin/value_end methods to DenseElementsAttr

Currently DenseElementsAttr only exposes the ability to get the full range of values for a given type T, but there are many situations where we just want the beginning/end iterator. This revision adds proper value_begin/value_end methods for all of the supported T types, and also cleans up a bit of the interface.

Differential Revision: https://reviews.llvm.org/D104173
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.h
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.td
The file was modifiedmlir/lib/CAPI/IR/BuiltinAttributes.cpp
The file was modifiedmlir/unittests/TableGen/StructsGenTest.cpp
The file was modifiedmlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
The file was modifiedmlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
The file was modifiedmlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
The file was modifiedmlir/lib/IR/AsmPrinter.cpp
The file was modifiedmlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
The file was modifiedmlir/lib/IR/BuiltinAttributes.cpp
The file was modifiedmlir/include/mlir/Dialect/CommonFolders.h
The file was modifiedmlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
The file was modifiedmlir/lib/Conversion/LinalgToSPIRV/LinalgToSPIRV.cpp
The file was modifiedmlir/lib/IR/Operation.cpp
The file was modifiedmlir/lib/Interfaces/InferTypeOpInterface.cpp
The file was modifiedmlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
The file was modifiedmlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
The file was modifiedmlir/lib/Dialect/GPU/IR/GPUDialect.cpp
Commit d80d3a358fffce430c94c7e9c716a5641010e4d0 by riddleriver
[mlir] Refactor ElementsAttr into an AttrInterface

This revision refactors ElementsAttr into an Attribute Interface.
This enables a common interface with which to interact with
element attributes, without needing to modify the builtin
dialect. It also removes a majority (if not all?) of the need for
the current OpaqueElementsAttr, which was originally intended as
a way to opaquely represent data that was not representable by
the other builtin constructs.

The new ElementsAttr interface not only allows for users to
natively represent their data in the way that best suits them,
it also allows for efficient opaque access and iteration of the
underlying data. Attributes using the ElementsAttr interface
can directly expose support for interacting with the held
elements using any C++ data type they claim to support. For
example, DenseIntOrFpElementsAttr supports iteration using
various native C++ integer/float data types, as well as
APInt/APFloat, and more. ElementsAttr instances that refer to
DenseIntOrFpElementsAttr can use all of these data types for
iteration:

```c++
DenseIntOrFpElementsAttr intElementsAttr = ...;

ElementsAttr attr = intElementsAttr;
for (uint64_t value : attr.getValues<uint64_t>())
  ...;
for (APInt value : attr.getValues<APInt>())
  ...;
for (IntegerAttr value : attr.getValues<IntegerAttr>())
  ...;
```

ElementsAttr also supports failable range/iterator access,
allowing for selective code paths depending on data type
support:

```c++
ElementsAttr attr = ...;
if (auto range = attr.tryGetValues<uint64_t>()) {
  for (uint64_t value : *range)
    ...;
}
```

Differential Revision: https://reviews.llvm.org/D109190
The file was modifiedmlir/test/lib/Dialect/Test/TestAttrDefs.td
The file was modifiedmlir/include/mlir/IR/CMakeLists.txt
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.h
The file was modifiedmlir/include/mlir/IR/BuiltinAttributes.td
The file was modifiedmlir/lib/IR/BuiltinAttributes.cpp
The file was addedmlir/test/IR/elements-attr-interface.mlir
The file was addedmlir/test/lib/IR/TestBuiltinAttributeInterfaces.cpp
The file was modifiedllvm/include/llvm/ADT/STLExtras.h
The file was modifiedmlir/test/lib/IR/CMakeLists.txt
The file was addedmlir/include/mlir/IR/BuiltinAttributeInterfaces.td
The file was modifiedmlir/lib/IR/CMakeLists.txt
The file was modifiedutils/bazel/llvm-project-overlay/mlir/BUILD.bazel
The file was modifiedmlir/tools/mlir-opt/mlir-opt.cpp
The file was modifiedmlir/include/mlir/Support/InterfaceSupport.h
The file was addedmlir/include/mlir/IR/BuiltinAttributeInterfaces.h
The file was modifiedmlir/test/lib/Dialect/Test/TestAttributes.cpp
The file was modifiedutils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel
The file was addedmlir/lib/IR/BuiltinAttributeInterfaces.cpp
Commit 85b4b21c8bbad346d58a30154d2767c39cf3285a by kazu
[llvm] Use make_early_inc_range (NFC)
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyOptimizeLiveIntervals.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
The file was modifiedllvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyReplacePhysRegs.cpp
The file was modifiedllvm/lib/Target/X86/X86OptimizeLEAs.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyLowerBrUnless.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp
The file was modifiedllvm/lib/Target/NVPTX/NVPTXGenericToNVVM.cpp
The file was modifiedllvm/lib/AsmParser/LLParser.cpp
The file was modifiedllvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
The file was modifiedllvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
The file was modifiedllvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
The file was modifiedllvm/lib/Target/WebAssembly/WebAssemblyPrepareForLiveIntervals.cpp