Skip to content
Commit ac14d5a1 authored by Laszlo Kindrat's avatar Laszlo Kindrat Committed by lorenzo chelini
Browse files

[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@gmail.com>

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D129601
parent 0d5a62fa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment