28 auto fillOp = extractOp.getSource().getDefiningOp<FillOp>();
29 if (!fillOp || !fillOp->hasOneUse())
32 auto newExtractOp = tensor::ExtractSliceOp::create(
33 rewriter, extractOp.getLoc(), extractOp.
getType(),
34 fillOp.getOutputs()[0], extractOp.getMixedOffsets(),
35 extractOp.getMixedSizes(), extractOp.getMixedStrides());
Ty getType(Args &&...args)
Get or construct an instance of the type Ty with provided arguments.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
This class provides an abstraction over the different types of ranges over Values.
void populateSwapExtractSliceWithFillPatterns(RewritePatternSet &patterns)
Adds patterns that waps tensor.extract_slice(linalg.fill(cst, init)) into linalg.fill(cst,...
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
OpRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting against an...
OpRewritePattern(MLIRContext *context, PatternBenefit benefit=1, ArrayRef< StringRef > generatedNames={})
Patterns must specify the root operation name they match against, and can also specify the benefit of...