20#define GEN_PASS_DEF_LOOPINVARIANTCODEMOTIONPASS
21#define GEN_PASS_DEF_LOOPINVARIANTSUBSETHOISTINGPASS
22#include "mlir/Transforms/Passes.h.inc"
29struct LoopInvariantCodeMotion
31 void runOnOperation()
override;
34struct LoopInvariantSubsetHoisting
36 LoopInvariantSubsetHoisting> {
37 void runOnOperation()
override;
41void LoopInvariantCodeMotion::runOnOperation() {
49void LoopInvariantSubsetHoisting::runOnOperation() {
50 IRRewriter rewriter(getOperation()->
getContext());
54 getOperation()->walk([&](LoopLikeOpInterface loopLike) {
Include the generated interface declarations.
LoopLikeOpInterface hoistLoopInvariantSubsets(RewriterBase &rewriter, LoopLikeOpInterface loopLike)
Hoist loop-invariant tensor subsets (subset extraction and subset insertion ops) from loop-like ops.
size_t moveLoopInvariantCode(ArrayRef< Region * > regions, function_ref< bool(Value, Region *)> isDefinedOutsideRegion, function_ref< bool(Operation *, Region *)> shouldMoveOutOfRegion, function_ref< void(Operation *, Region *)> moveOutOfRegion)
Given a list of regions, perform loop-invariant code motion.