15#include "llvm/Support/Debug.h"
20#define GEN_PASS_DEF_BUBBLEDOWNMEMORYSPACECASTS
21#include "mlir/Transforms/Passes.h.inc"
29struct BubbleDownCastsPattern
33 LogicalResult matchAndRewrite(MemorySpaceCastConsumerOpInterface op,
34 PatternRewriter &rewriter)
const override {
35 FailureOr<std::optional<SmallVector<Value>>> results =
36 op.bubbleDownCasts(rewriter);
39 if (!results->has_value()) {
52struct BubbleDownMemorySpaceCasts
OpT getOperation()
Return the current operation being transformed.
virtual void runOnOperation()=0
The polymorphic API that runs the pass over the currently held operation.
void signalPassFailure()
Signal that some invariant was broken when running.
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
virtual void replaceOp(Operation *op, ValueRange newValues)
Replace the results of the given (original) operation with the specified list of values (replacements...
void modifyOpInPlace(Operation *root, CallableT &&callable)
This method is a utility wrapper around an in-place modification of an operation.
BubbleDownMemorySpaceCastsBase()
Include the generated interface declarations.
LogicalResult applyPatternsGreedily(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...
const FrozenRewritePatternSet & patterns
void populateBubbleDownMemorySpaceCastPatterns(RewritePatternSet &patterns, PatternBenefit benefit)
Collect a set of patterns to bubble-down memory-space cast operations.
OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting a...
OpInterfaceRewritePattern(MLIRContext *context, PatternBenefit benefit=1)