[PATCH] D79518: [mlir][Linalg] Introduce a helper function for staged pattern application
Alex Zinenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 9 02:37:18 PDT 2020
ftynse accepted this revision.
ftynse added inline comments.
================
Comment at: mlir/include/mlir/IR/PatternMatch.h:394
+ /// Construct a OwningRewritePatternList populated with one pattern of type
+ /// 'T' constructed from the given arguments
+ template <typename T>
----------------
Doc doesn't match the code
================
Comment at: mlir/include/mlir/IR/PatternMatch.h:397
+ OwningRewritePatternList(T &&t) {
+ patterns.emplace_back(std::make_unique<T>(t));
+ }
----------------
This looks like it's calling the move constructor of T (pattern class), not constructing the pattern in-place from the arguments. I was thinking about literally forwarding to `insert`, something like
```
template <typename... Ts, typename ConstructorArg,
typename... ConstructorArgs,
typename = std::enable_if_t<sizeof...(Ts) != 0>>
OwningRewritePatternList(ConstructorArg &&arg, ConstructorArgs &&... args) {
insert<Ts...>(std::forward<ConstructorArg>(arg), std::forward<ConstructorArgs>(args)...);
}
```
but I guess the pattern-move constructor works too, if you fix the documentation.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79518/new/
https://reviews.llvm.org/D79518
More information about the llvm-commits
mailing list