16 #include "PassDetail.h" 28 struct ControlFlowSink :
public ControlFlowSinkBase<ControlFlowSink> {
29 void runOnOperation()
override;
33 void ControlFlowSink::runOnOperation() {
34 auto &domInfo = getAnalysis<DominanceInfo>();
35 getOperation()->walk([&](RegionBranchOpInterface branch) {
41 regionsToSink, domInfo,
47 op->
moveBefore(®ion->front(), region->front().begin());
53 return std::make_unique<ControlFlowSink>();
void moveBefore(Operation *existingOp)
Unlink this operation from its current block and insert it right before existingOp which may be in th...
Include the generated interface declarations.
This class contains a list of basic blocks and a link to the parent operation it is attached to...
Operation is a basic unit of execution within MLIR.
std::unique_ptr< Pass > createControlFlowSinkPass()
Creates a pass to perform control-flow sinking.
bool isSideEffectFree(Operation *op)
Returns true if the given operation is side-effect free.
size_t controlFlowSink(RegionRange regions, DominanceInfo &domInfo, function_ref< bool(Operation *, Region *)> shouldMoveIntoRegion, function_ref< void(Operation *, Region *)> moveIntoRegion)
Given a list of regions, perform control flow sinking on them.
void getSinglyExecutedRegionsToSink(RegionBranchOpInterface branch, SmallVectorImpl< Region *> ®ions)
Populates regions with regions of the provided region branch op that are executed at most once at tha...