[all-commits] [llvm/llvm-project] 26d811: [mlir] Make use of C++17 language features

zero9178 via All-commits all-commits at lists.llvm.org
Sun Aug 7 02:17:02 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 26d811b3ecd2fa1ca3d9b41e17fb42b8c7ad03d6
      https://github.com/llvm/llvm-project/commit/26d811b3ecd2fa1ca3d9b41e17fb42b8c7ad03d6
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-08-07 (Sun, 07 Aug 2022)

  Changed paths:
    M mlir/examples/standalone/CMakeLists.txt
    M mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
    M mlir/include/mlir/Dialect/Transform/IR/TransformDialect.td
    M mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
    M mlir/include/mlir/IR/BuiltinAttributes.h
    M mlir/include/mlir/IR/BuiltinTypes.td
    M mlir/include/mlir/IR/Dialect.h
    M mlir/include/mlir/IR/DialectRegistry.h
    M mlir/include/mlir/IR/Matchers.h
    M mlir/include/mlir/IR/OpDefinition.h
    M mlir/include/mlir/IR/PatternMatch.h
    M mlir/include/mlir/IR/StorageUniquerSupport.h
    M mlir/include/mlir/Support/InterfaceSupport.h
    M mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
    M mlir/lib/Dialect/Linalg/IR/LinalgDialect.cpp
    M mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
    M mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
    M mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp
    M mlir/lib/IR/BuiltinTypes.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list