21 #define GEN_PASS_DEF_CONVERTSHAPECONSTRAINTS
22 #include "mlir/Conversion/Passes.h.inc"
28 #include "ShapeToStandard.cpp.inc"
35 LogicalResult matchAndRewrite(shape::CstrRequireOp op,
37 rewriter.
create<cf::AssertOp>(op.getLoc(), op.getPred(), op.getMsgAttr());
46 patterns.
add<CstrBroadcastableToRequire>(patterns.
getContext());
56 class ConvertShapeConstraints
57 :
public impl::ConvertShapeConstraintsBase<ConvertShapeConstraints> {
58 void runOnOperation()
override {
59 auto *func = getOperation();
66 return signalPassFailure();
72 return std::make_unique<ConvertShapeConstraints>();
static MLIRContext * getContext(OpFoldResult val)
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...
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...
Include the generated interface declarations.
LogicalResult applyPatternsAndFoldGreedily(Region ®ion, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr)
Rewrite ops in the given region, which must be isolated from above, by repeatedly applying the highes...
std::unique_ptr< Pass > createConvertShapeConstraintsPass()
void populateConvertShapeConstraintsConversionPatterns(RewritePatternSet &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...