19 #define DEBUG_TYPE "vector-step-lowering"
26 struct StepToArithConstantOpRewrite final :
OpRewritePattern<vector::StepOp> {
29 LogicalResult matchAndRewrite(vector::StepOp stepOp,
31 auto resultType = cast<VectorType>(stepOp.getType());
32 if (resultType.isScalable()) {
35 int64_t elementCount = resultType.getNumElements();
37 llvm::map_to_vector(llvm::seq(elementCount),
38 [](int64_t i) {
return APInt(64, i); });
48 patterns.
add<StepToArithConstantOpRewrite>(patterns.
getContext(), benefit);
static DenseElementsAttr get(ShapedType type, ArrayRef< Attribute > values)
Constructs a dense elements attribute from an array of element values.
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...
MLIRContext * getContext() const
RewritePatternSet & add(ConstructorArg &&arg, ConstructorArgs &&...args)
Add an instance of each of the pattern types 'Ts' to the pattern list with the given arguments.
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
void populateVectorStepLoweringPatterns(RewritePatternSet &patterns, PatternBenefit benefit=1)
Populate the pattern set with the following patterns:
Include the generated interface declarations.
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...