[all-commits] [llvm/llvm-project] a0a768: [ADT] Allow `llvm::enumerate` to enumerate over mu...
Jakub Kuderski via All-commits
all-commits at lists.llvm.org
Wed Mar 15 16:36:57 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: a0a76804c4b56058ba3dcd7374bcaec2fec3978e
https://github.com/llvm/llvm-project/commit/a0a76804c4b56058ba3dcd7374bcaec2fec3978e
Author: Jakub Kuderski <kubak at google.com>
Date: 2023-03-15 (Wed, 15 Mar 2023)
Changed paths:
M llvm/include/llvm/ADT/STLExtras.h
M llvm/lib/Target/AArch64/AArch64PerfectShuffle.h
M llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
M llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
M llvm/tools/llvm-mca/Views/InstructionInfoView.cpp
M llvm/unittests/ADT/STLExtrasTest.cpp
M llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp
M mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
M mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
M mlir/lib/Dialect/SCF/IR/SCF.cpp
M mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp
M mlir/lib/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.cpp
M mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp
M mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
Log Message:
-----------
[ADT] Allow `llvm::enumerate` to enumerate over multiple ranges
This does not work by a mere composition of `enumerate` and `zip_equal`,
because C++17 does not allow for recursive expansion of structured
bindings.
This implementation uses `zippy` to manage the iteratees and adds the
stream of indices as the first zipped range. Because we have an upfront
assertion that all input ranges are of the same length, we only need to
check if the second range has ended during iteration.
As a consequence of using `zippy`, `enumerate` will now follow the
reference and lifetime semantics of the `zip*` family of functions. The
main difference is that `enumerate` exposes each tuple of references
through a new tuple-like type `enumerate_result`, with the familiar
`.index()` and `.value()` member functions.
Because the `enumerate_result` returned on dereference is a
temporary, enumeration result can no longer be used through an
lvalue ref.
Reviewed By: dblaikie, zero9178
Differential Revision: https://reviews.llvm.org/D144503
More information about the All-commits
mailing list