[all-commits] [llvm/llvm-project] ac14d5: [mlir] Enable perfect forwarding in RewritePattern...
Laszlo Kindrat via All-commits
all-commits at lists.llvm.org
Fri Jul 15 10:44:43 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ac14d5a1db4b498cf38e5d79e09fa90a8715909b
https://github.com/llvm/llvm-project/commit/ac14d5a1db4b498cf38e5d79e09fa90a8715909b
Author: Laszlo Kindrat <laszlokindrat at gmail.com>
Date: 2022-07-15 (Fri, 15 Jul 2022)
Changed paths:
M mlir/include/mlir/IR/PatternMatch.h
M mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp
Log Message:
-----------
[mlir] Enable perfect forwarding in RewritePatternSet::add
This patch modifies the implementation of `RewritePatternSet::add` to perfectly forward its arguments to pattern constructors. Without this, code like the following compiles but, due to the limited lifetime of the temporary TypeConverter, can produce unexpected behavior:
```
RewritePatternSet patterns(context);
patterns.add<SomeOpConversion, OtherOpConversion>(TypeConverter(), context);
if (failed(applyPartialConversion(getOperation(), target, std::move(patterns))))
return signalPassFailure();
```
The patch also changes the linalg fusion pattern implementation to correctly fill the test pattern set given the new behavior.
Author: Laszlo Kindrat <laszlokindrat at gmail.com>
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D129601
More information about the All-commits
mailing list