15 #include "llvm/Support/Debug.h"
20 #define GEN_PASS_DEF_BUBBLEDOWNMEMORYSPACECASTS
21 #include "mlir/Transforms/Passes.h.inc"
29 struct BubbleDownCastsPattern
33 LogicalResult matchAndRewrite(MemorySpaceCastConsumerOpInterface op,
35 FailureOr<std::optional<SmallVector<Value>>> results =
36 op.bubbleDownCasts(rewriter);
39 if (!results->has_value()) {
52 struct BubbleDownMemorySpaceCasts
53 :
public impl::BubbleDownMemorySpaceCastsBase<BubbleDownMemorySpaceCasts> {
54 using impl::BubbleDownMemorySpaceCastsBase<
55 BubbleDownMemorySpaceCasts>::BubbleDownMemorySpaceCastsBase;
57 void runOnOperation()
override {
static MLIRContext * getContext(OpFoldResult val)
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...
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.
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)