[PATCH] D79518: [mlir][Linalg] Introduce a helper function for staged pattern application
Nicolas Vasilache via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 11 13:29:05 PDT 2020
nicolasvasilache marked 3 inline comments as done.
nicolasvasilache added inline comments.
================
Comment at: mlir/include/mlir/IR/PatternMatch.h:397
+ OwningRewritePatternList(T &&t) {
+ patterns.emplace_back(std::make_unique<T>(t));
+ }
----------------
ftynse wrote:
> 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.
Yeah, didn't manage to get the combination of emplace_back + templated ctor to work so I went with the move constructor. Feel free to give it a shot if you find the templatefu better (I don't necessarily).
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