14 #ifndef MLIR_TRANSFORMS_GREEDYPATTERNREWRITEDRIVER_H_
15 #define MLIR_TRANSFORMS_GREEDYPATTERNREWRITEDRIVER_H_
132 LLVM_DEPRECATED(
"Use applyPatternsGreedily() instead",
"applyPatternsGreedily")
170 bool anyRegionChanged =
false;
176 anyRegionChanged |= regionChanged;
180 return failure(failed);
184 LLVM_DEPRECATED(
"Use applyPatternsGreedily() instead",
"applyPatternsGreedily")
224 const FrozenRewritePatternSet &
patterns,
225 GreedyRewriteConfig
config = GreedyRewriteConfig(),
226 bool *
changed =
nullptr,
bool *allErased =
nullptr);
230 "applyOpPatternsGreedily")
235 bool *
changed =
nullptr,
bool *allErased =
nullptr) {
This class represents a frozen set of patterns that can be processed by a pattern applicator.
This class allows control over how the GreedyPatternRewriteDriver works.
static constexpr int64_t kNoLimit
GreedyRewriteStrictness strictMode
Strict mode can restrict the ops that are added to the worklist during the rewrite.
int64_t maxIterations
This specifies the maximum number of times the rewriter will iterate between applying patterns and si...
bool fold
Whether this should fold while greedily rewriting.
Region * scope
Only ops within the scope are added to the worklist.
bool useTopDownTraversal
This specifies the order of initial traversal that populates the rewriters worklist.
bool cseConstants
If set to "true", constants are CSE'd (even across multiple regions that are in a parent-ancestor rel...
RewriterBase::Listener * listener
An optional listener that should be notified about IR modifications.
int64_t maxNumRewrites
This specifies the maximum number of rewrites within an iteration.
GreedySimplifyRegionLevel enableRegionSimplification
Perform control flow optimizations to the region tree after applying all patterns.
Operation is the basic unit of execution within MLIR.
MutableArrayRef< Region > getRegions()
Returns the regions held by this operation.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Include the generated interface declarations.
const FrozenRewritePatternSet GreedyRewriteConfig bool * changed
GreedySimplifyRegionLevel
@ Aggressive
Run extra simplificiations (e.g.
@ Normal
Run the normal simplification (e.g. dead args elimination).
@ Disabled
Disable region control-flow simplification.
const FrozenRewritePatternSet GreedyRewriteConfig config
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...
LogicalResult applyOpPatternsGreedily(ArrayRef< Operation * > ops, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr, bool *allErased=nullptr)
Rewrite the specified ops by repeatedly applying the highest benefit patterns in a greedy worklist dr...
LLVM_DEPRECATED("Use applyOpPatternsGreedily() instead", "applyOpPatternsGreedily") inline LogicalResult applyOpPatternsAndFold(ArrayRef< Operation * > ops
Same as applyOpPatternsGreedily with folding.
const FrozenRewritePatternSet & patterns
LogicalResult applyPatternsAndFoldGreedily(Region ®ion, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr)
Same as applyPatternsAndGreedily above with folding.
GreedyRewriteStrictness
This enum controls which ops are put on the worklist during a greedy pattern rewrite.
@ ExistingOps
Only pre-existing ops are processed.
@ ExistingAndNewOps
Only pre-existing and newly created ops are processed.
@ AnyOp
No restrictions wrt. which ops are processed.