[llvm] Make Sequence reverse-iterable
authorGuillaume Chatelet <gchatelet@google.com>
Thu, 10 Jun 2021 11:15:28 +0000 (11:15 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Thu, 10 Jun 2021 11:15:28 +0000 (11:15 +0000)
commite0569033e21ded970783cab557ba034b134b9c69
tree734c236f80d77752ec0cb3c3d9f60842c77375d1
parentec43c1213a16969aeec6ac7a5b894ec1389e4d71
[llvm] Make Sequence reverse-iterable

This is a roll forward of D102679.
This patch simplifies the implementation of Sequence and makes it compatible with llvm::reverse.
It exposes the reverse iterators through rbegin/rend which prevents a dangling reference in std::reverse_iterator::operator++().

Note: Compared to D102679, this patch introduces a `asSmallVector()` member function and fixes compilation issue with GCC 5.

Differential Revision: https://reviews.llvm.org/D103948
llvm/include/llvm/ADT/Sequence.h
llvm/unittests/ADT/SequenceTest.cpp
mlir/include/mlir/IR/BuiltinAttributes.td
mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp