[all-commits] [llvm/llvm-project] b0afda: [mlir] Enable perfect forwarding in RewritePattern...
lorenzo chelini via All-commits
all-commits at lists.llvm.org
Fri Jul 15 10:09:37 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b0afda78f007740371307bfacbe4a486a4b77a3e
https://github.com/llvm/llvm-project/commit/b0afda78f007740371307bfacbe4a486a4b77a3e
Author: lorenzo chelini <l.chelini at icloud.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