9 #ifndef MLIR_TRANSFORMS_MEM2REG_H
10 #define MLIR_TRANSFORMS_MEM2REG_H
16 #include "llvm/ADT/Statistic.h"
39 LogicalResult
matchAndRewrite(PromotableAllocationOpInterface allocator,
40 PatternRewriter &rewriter)
const override;
43 Mem2RegStatistics statistics;
50 RewriterBase &rewriter,
51 Mem2RegStatistics statistics = {});
MLIRContext is the top-level object for a collection of MLIR operations.
Pattern applying mem2reg to the regions of the operations on which it matches.
LogicalResult matchAndRewrite(PromotableAllocationOpInterface allocator, PatternRewriter &rewriter) const override
Mem2RegPattern(MLIRContext *context, Mem2RegStatistics statistics={}, PatternBenefit benefit=1)
OpInterfaceRewritePattern(MLIRContext *context, PatternBenefit benefit=1)
This class represents the benefit of a pattern match in a unitless scheme that ranges from 0 (very li...
Include the generated interface declarations.
LogicalResult tryToPromoteMemorySlots(ArrayRef< PromotableAllocationOpInterface > allocators, RewriterBase &rewriter, Mem2RegStatistics statistics={})
Attempts to promote the memory slots of the provided allocators.
Statistics collected while applying mem2reg.
llvm::Statistic * promotedAmount
Total amount of memory slots promoted.
llvm::Statistic * newBlockArgumentAmount
Total amount of new block arguments inserted in blocks.
OpInterfaceRewritePattern is a wrapper around RewritePattern that allows for matching and rewriting a...
OpInterfaceRewritePattern(MLIRContext *context, PatternBenefit benefit=1)