9 #ifndef MLIR_TRANSFORMS_REGIONUTILS_H_
10 #define MLIR_TRANSFORMS_REGIONUTILS_H_
15 #include "llvm/ADT/SetVector.h"
23 template <
typename Range>
25 for (
Value v : values)
26 if (!v.getParentRegion()->isProperAncestor(&limit))
47 SetVector<Value> &values);
52 SetVector<Value> &values);
68 RewriterBase &rewriter, Region ®ion,
70 [](Operation *) {
return false; });
80 MutableArrayRef<Region> regions,
81 bool mergeBlocks =
true);
86 MutableArrayRef<Region> regions);
91 MutableArrayRef<Region> regions);
This class contains a list of basic blocks and a link to the parent operation it is attached to.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Include the generated interface declarations.
llvm::function_ref< Fn > function_ref
void replaceAllUsesInRegionWith(Value orig, Value replacement, Region ®ion)
Replace all uses of orig within the given region with replacement.
LogicalResult eraseUnreachableBlocks(RewriterBase &rewriter, MutableArrayRef< Region > regions)
Erase the unreachable blocks within the provided regions.
SmallVector< Value > makeRegionIsolatedFromAbove(RewriterBase &rewriter, Region ®ion, llvm::function_ref< bool(Operation *)> cloneOperationIntoRegion=[](Operation *) { return false;})
Make a region isolated from above.
void getUsedValuesDefinedAbove(Region ®ion, Region &limit, SetVector< Value > &values)
Fill values with a list of values defined at the ancestors of the limit region and used within region...
LogicalResult runRegionDCE(RewriterBase &rewriter, MutableArrayRef< Region > regions)
This function returns success if any operations or arguments were deleted, failure otherwise.
bool areValuesDefinedAbove(Range values, Region &limit)
Check if all values in the provided range are defined above the limit region.
LogicalResult simplifyRegions(RewriterBase &rewriter, MutableArrayRef< Region > regions, bool mergeBlocks=true)
Run a set of structural simplifications over the given regions.
void visitUsedValuesDefinedAbove(Region ®ion, Region &limit, function_ref< void(OpOperand *)> callback)
Calls callback for each use of a value within region or its descendants that was defined at the ances...
Represents a range (offset, size, and stride) where each element of the triple may be dynamic or stat...