17 #define DEBUG_TYPE "lower-vector-from-elements"
42 LogicalResult matchAndRewrite(vector::FromElementsOp op,
47 VectorType subTy, int64_t index) {
48 size_t subTyNumElements = subTy.getNumElements();
49 assert((index + 1) * subTyNumElements <= allElements.size() &&
52 allElements.slice(index * subTyNumElements, subTyNumElements);
53 return vector::FromElementsOp::create(rewriter, loc, subTy, subElements);
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
This class provides an abstraction over the different types of ranges over Values.
void populateVectorFromElementsLoweringPatterns(RewritePatternSet &patterns, PatternBenefit benefit=1)
Populate the pattern set with the following patterns:
LogicalResult unrollVectorOp(Operation *op, PatternRewriter &rewriter, UnrollVectorOpFn unrollFn)
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...