[mlir] Make use of C++17 language features
authorMarkus Böck <markus.boeck02@gmail.com>
Sun, 7 Aug 2022 09:16:38 +0000 (11:16 +0200)
committerMarkus Böck <markus.boeck02@gmail.com>
Sun, 7 Aug 2022 09:16:49 +0000 (11:16 +0200)
commit26d811b3ecd2fa1ca3d9b41e17fb42b8c7ad03d6
treed58eb40549ace0de14290b6f1d581fd838723490
parentf0f1bcadc74fa5cd11a118673340ca3e9a8c0037
[mlir] Make use of C++17 language features

Now that C++17 is enabled in LLVM, a lot of the TODOs and patterns to emulate C++17 features can be eliminated.
The steps I have taken were essentially:
```
git grep C++17
git grep c++17
git grep "initializer_list<int>"
```
and address given comments and patterns.
Most of the changes boiled down to just using fold expressions rather than initializer_list.

While doing this I also discovered that Clang by default restricts the depth of fold expressions to 256 elements. I specifically hit this with `TestDialect` in `addOperations`. I opted to not replace it with fold expressions because of that but instead adding a comment documenting the issue.
If any other functions may be called with more than 256 elements in the future we might have to revert other parts as well.
I don't think this is a common occurence besides the `TestDialect` however. If need be, this could potentially be fixed via `mlir-tblgen` in the future.

Differential Revision: https://reviews.llvm.org/D131323
19 files changed:
mlir/examples/standalone/CMakeLists.txt
mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
mlir/include/mlir/IR/BuiltinAttributes.h
mlir/include/mlir/IR/BuiltinTypes.td
mlir/include/mlir/IR/Dialect.h
mlir/include/mlir/IR/DialectRegistry.h
mlir/include/mlir/IR/Matchers.h
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/IR/PatternMatch.h
mlir/include/mlir/IR/StorageUniquerSupport.h
mlir/include/mlir/Support/InterfaceSupport.h
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
mlir/lib/IR/BuiltinTypes.cpp