24 auto fillOp = extractOp.getSource().getDefiningOp<FillOp>();
25 if (!fillOp || !fillOp->hasOneUse())
28 auto newExtractOp = rewriter.
create<tensor::ExtractSliceOp>(
29 extractOp.getLoc(), extractOp.getType(), fillOp.getOutputs()[0],
30 extractOp.getMixedOffsets(), extractOp.getMixedSizes(),
31 extractOp.getMixedStrides());
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
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...