Skip to content

Commit 09dfc57

Browse files
authored
[mlir] Enable decoupling two kinds of greedy behavior. (#104649)
The greedy rewriter is used in many different flows and it has a lot of convenience (work list management, debugging actions, tracing, etc). But it combines two kinds of greedy behavior 1) how ops are matched, 2) folding wherever it can. These are independent forms of greedy and leads to inefficiency. E.g., cases where one need to create different phases in lowering and is required to applying patterns in specific order split across different passes. Using the driver one ends up needlessly retrying folding/having multiple rounds of folding attempts, where one final run would have sufficed. Of course folks can locally avoid this behavior by just building their own, but this is also a common requested feature that folks keep on working around locally in suboptimal ways. For downstream users, there should be no behavioral change. Updating from the deprecated should just be a find and replace (e.g., `find ./ -type f -exec sed -i 's|applyPatternsAndFoldGreedily|applyPatternsGreedily|g' {} \;` variety) as the API arguments hasn't changed between the two.
1 parent 412e1af commit 09dfc57

File tree

110 files changed

+313
-246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+313
-246
lines changed

flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class InlineElementalsPass
125125
mlir::RewritePatternSet patterns(context);
126126
patterns.insert<InlineElementalConversion>(context);
127127

128-
if (mlir::failed(mlir::applyPatternsAndFoldGreedily(
128+
if (mlir::failed(mlir::applyPatternsGreedily(
129129
getOperation(), std::move(patterns), config))) {
130130
mlir::emitError(getOperation()->getLoc(),
131131
"failure in HLFIR elemental inlining");

flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ class LowerHLFIRIntrinsics
520520
config.enableRegionSimplification =
521521
mlir::GreedySimplifyRegionLevel::Disabled;
522522

523-
if (mlir::failed(mlir::applyPatternsAndFoldGreedily(
524-
module, std::move(patterns), config))) {
523+
if (mlir::failed(
524+
mlir::applyPatternsGreedily(module, std::move(patterns), config))) {
525525
mlir::emitError(mlir::UnknownLoc::get(context),
526526
"failure in HLFIR intrinsic lowering");
527527
signalPassFailure();

flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ class OptimizedBufferizationPass
13721372
// patterns.insert<ReductionMaskConversion<hlfir::MaxvalOp>>(context);
13731373
// patterns.insert<ReductionMaskConversion<hlfir::MinvalOp>>(context);
13741374

1375-
if (mlir::failed(mlir::applyPatternsAndFoldGreedily(
1375+
if (mlir::failed(mlir::applyPatternsGreedily(
13761376
getOperation(), std::move(patterns), config))) {
13771377
mlir::emitError(getOperation()->getLoc(),
13781378
"failure in HLFIR optimized bufferization");

flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ class SimplifyHLFIRIntrinsics
491491
patterns.insert<SumAsElementalConversion>(context);
492492
patterns.insert<CShiftAsElementalConversion>(context);
493493

494-
if (mlir::failed(mlir::applyPatternsAndFoldGreedily(
494+
if (mlir::failed(mlir::applyPatternsGreedily(
495495
getOperation(), std::move(patterns), config))) {
496496
mlir::emitError(getOperation()->getLoc(),
497497
"failure in HLFIR intrinsic simplification");

flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ struct AlgebraicSimplification
3939
void AlgebraicSimplification::runOnOperation() {
4040
RewritePatternSet patterns(&getContext());
4141
populateMathAlgebraicSimplificationPatterns(patterns);
42-
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns),
43-
config);
42+
(void)applyPatternsGreedily(getOperation(), std::move(patterns), config);
4443
}
4544

4645
std::unique_ptr<mlir::Pass> fir::createAlgebraicSimplificationPass() {

flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class AssumedRankOpConversion
154154
mlir::GreedyRewriteConfig config;
155155
config.enableRegionSimplification =
156156
mlir::GreedySimplifyRegionLevel::Disabled;
157-
(void)applyPatternsAndFoldGreedily(mod, std::move(patterns), config);
157+
(void)applyPatternsGreedily(mod, std::move(patterns), config);
158158
}
159159
};
160160
} // namespace

flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ class ConstantArgumentGlobalisationOpt
173173
config.strictMode = mlir::GreedyRewriteStrictness::ExistingOps;
174174

175175
patterns.insert<CallOpRewriter>(context, *di);
176-
if (mlir::failed(mlir::applyPatternsAndFoldGreedily(
177-
mod, std::move(patterns), config))) {
176+
if (mlir::failed(
177+
mlir::applyPatternsGreedily(mod, std::move(patterns), config))) {
178178
mlir::emitError(mod.getLoc(),
179179
"error in constant globalisation optimization\n");
180180
signalPassFailure();

flang/lib/Optimizer/Transforms/StackArrays.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,8 @@ void StackArraysPass::runOnOperation() {
793793
config.enableRegionSimplification = mlir::GreedySimplifyRegionLevel::Disabled;
794794

795795
patterns.insert<AllocMemConversion>(&context, *candidateOps);
796-
if (mlir::failed(mlir::applyOpPatternsAndFold(opsToConvert,
797-
std::move(patterns), config))) {
796+
if (mlir::failed(mlir::applyOpPatternsGreedily(
797+
opsToConvert, std::move(patterns), config))) {
798798
mlir::emitError(func->getLoc(), "error in stack arrays optimization\n");
799799
signalPassFailure();
800800
}

mlir/docs/PatternRewriter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ which point the driver finishes.
358358

359359
This driver comes in two fashions:
360360

361-
* `applyPatternsAndFoldGreedily` ("region-based driver") applies patterns to
361+
* `applyPatternsGreedily` ("region-based driver") applies patterns to
362362
all ops in a given region or a given container op (but not the container op
363363
itself). I.e., the worklist is initialized with all containing ops.
364364
* `applyOpPatternsAndFold` ("op-based driver") applies patterns to the

mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class StandaloneSwitchBarFoo
3939
RewritePatternSet patterns(&getContext());
4040
patterns.add<StandaloneSwitchBarFooRewriter>(&getContext());
4141
FrozenRewritePatternSet patternSet(std::move(patterns));
42-
if (failed(applyPatternsAndFoldGreedily(getOperation(), patternSet)))
42+
if (failed(applyPatternsGreedily(getOperation(), patternSet)))
4343
signalPassFailure();
4444
}
4545
};

mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ class GreedyRewriteConfig {
9191

9292
/// An optional listener that should be notified about IR modifications.
9393
RewriterBase::Listener *listener = nullptr;
94+
95+
/// Whether this should fold while greedily rewriting.
96+
bool fold = true;
97+
98+
/// If set to "true", constants are CSE'd (even across multiple regions that
99+
/// are in a parent-ancestor relationship).
100+
bool cseConstants = true;
94101
};
95102

96103
//===----------------------------------------------------------------------===//
@@ -104,8 +111,8 @@ class GreedyRewriteConfig {
104111
/// The greedy rewrite may prematurely stop after a maximum number of
105112
/// iterations, which can be configured in the configuration parameter.
106113
///
107-
/// Also performs folding and simple dead-code elimination before attempting to
108-
/// match any of the provided patterns.
114+
/// Also performs simple dead-code elimination before attempting to match any of
115+
/// the provided patterns.
109116
///
110117
/// A region scope can be set in the configuration parameter. By default, the
111118
/// scope is set to the specified region. Only in-scope ops are added to the
@@ -117,10 +124,20 @@ class GreedyRewriteConfig {
117124
///
118125
/// Note: This method does not apply patterns to the region's parent operation.
119126
LogicalResult
127+
applyPatternsGreedily(Region &region, const FrozenRewritePatternSet &patterns,
128+
GreedyRewriteConfig config = GreedyRewriteConfig(),
129+
bool *changed = nullptr);
130+
/// Same as `applyPatternsAndGreedily` above with folding.
131+
/// FIXME: Remove this once transition to above is complieted.
132+
LLVM_DEPRECATED("Use applyPatternsGreedily() instead", "applyPatternsGreedily")
133+
inline LogicalResult
120134
applyPatternsAndFoldGreedily(Region &region,
121135
const FrozenRewritePatternSet &patterns,
122136
GreedyRewriteConfig config = GreedyRewriteConfig(),
123-
bool *changed = nullptr);
137+
bool *changed = nullptr) {
138+
config.fold = true;
139+
return applyPatternsGreedily(region, patterns, config, changed);
140+
}
124141

125142
/// Rewrite ops nested under the given operation, which must be isolated from
126143
/// above, by repeatedly applying the highest benefit patterns in a greedy
@@ -129,8 +146,8 @@ applyPatternsAndFoldGreedily(Region &region,
129146
/// The greedy rewrite may prematurely stop after a maximum number of
130147
/// iterations, which can be configured in the configuration parameter.
131148
///
132-
/// Also performs folding and simple dead-code elimination before attempting to
133-
/// match any of the provided patterns.
149+
/// Also performs simple dead-code elimination before attempting to match any of
150+
/// the provided patterns.
134151
///
135152
/// This overload runs a separate greedy rewrite for each region of the
136153
/// specified op. A region scope can be set in the configuration parameter. By
@@ -147,57 +164,78 @@ applyPatternsAndFoldGreedily(Region &region,
147164
///
148165
/// Note: This method does not apply patterns to the given operation itself.
149166
inline LogicalResult
150-
applyPatternsAndFoldGreedily(Operation *op,
151-
const FrozenRewritePatternSet &patterns,
152-
GreedyRewriteConfig config = GreedyRewriteConfig(),
153-
bool *changed = nullptr) {
167+
applyPatternsGreedily(Operation *op, const FrozenRewritePatternSet &patterns,
168+
GreedyRewriteConfig config = GreedyRewriteConfig(),
169+
bool *changed = nullptr) {
154170
bool anyRegionChanged = false;
155171
bool failed = false;
156172
for (Region &region : op->getRegions()) {
157173
bool regionChanged;
158-
failed |=
159-
applyPatternsAndFoldGreedily(region, patterns, config, &regionChanged)
160-
.failed();
174+
failed |= applyPatternsGreedily(region, patterns, config, &regionChanged)
175+
.failed();
161176
anyRegionChanged |= regionChanged;
162177
}
163178
if (changed)
164179
*changed = anyRegionChanged;
165180
return failure(failed);
166181
}
182+
/// Same as `applyPatternsGreedily` above with folding.
183+
/// FIXME: Remove this once transition to above is complieted.
184+
LLVM_DEPRECATED("Use applyPatternsGreedily() instead", "applyPatternsGreedily")
185+
inline LogicalResult
186+
applyPatternsAndFoldGreedily(Operation *op,
187+
const FrozenRewritePatternSet &patterns,
188+
GreedyRewriteConfig config = GreedyRewriteConfig(),
189+
bool *changed = nullptr) {
190+
config.fold = true;
191+
return applyPatternsGreedily(op, patterns, config, changed);
192+
}
167193

168194
/// Rewrite the specified ops by repeatedly applying the highest benefit
169195
/// patterns in a greedy worklist driven manner until a fixpoint is reached.
170196
///
171197
/// The greedy rewrite may prematurely stop after a maximum number of
172198
/// iterations, which can be configured in the configuration parameter.
173199
///
174-
/// Also performs folding and simple dead-code elimination before attempting to
175-
/// match any of the provided patterns.
200+
/// Also performs simple dead-code elimination before attempting to match any of
201+
/// the provided patterns.
176202
///
177203
/// Newly created ops and other pre-existing ops that use results of rewritten
178204
/// ops or supply operands to such ops are also processed, unless such ops are
179205
/// excluded via `config.strictMode`. Any other ops remain unmodified (i.e.,
180206
/// regardless of `strictMode`).
181207
///
182208
/// In addition to strictness, a region scope can be specified. Only ops within
183-
/// the scope are simplified. This is similar to `applyPatternsAndFoldGreedily`,
209+
/// the scope are simplified. This is similar to `applyPatternsGreedily`,
184210
/// where only ops within the given region/op are simplified by default. If no
185211
/// scope is specified, it is assumed to be the first common enclosing region of
186212
/// the given ops.
187213
///
188214
/// Note that ops in `ops` could be erased as result of folding, becoming dead,
189215
/// or via pattern rewrites. If more far reaching simplification is desired,
190-
/// `applyPatternsAndFoldGreedily` should be used.
216+
/// `applyPatternsGreedily` should be used.
191217
///
192218
/// Returns "success" if the iterative process converged (i.e., fixpoint was
193219
/// reached) and no more patterns can be matched. `changed` is set to "true" if
194220
/// the IR was modified at all. `allOpsErased` is set to "true" if all ops in
195221
/// `ops` were erased.
196222
LogicalResult
223+
applyOpPatternsGreedily(ArrayRef<Operation *> ops,
224+
const FrozenRewritePatternSet &patterns,
225+
GreedyRewriteConfig config = GreedyRewriteConfig(),
226+
bool *changed = nullptr, bool *allErased = nullptr);
227+
/// Same as `applyOpPatternsGreedily` with folding.
228+
/// FIXME: Remove this once transition to above is complieted.
229+
LLVM_DEPRECATED("Use applyOpPatternsGreedily() instead",
230+
"applyOpPatternsGreedily")
231+
inline LogicalResult
197232
applyOpPatternsAndFold(ArrayRef<Operation *> ops,
198233
const FrozenRewritePatternSet &patterns,
199234
GreedyRewriteConfig config = GreedyRewriteConfig(),
200-
bool *changed = nullptr, bool *allErased = nullptr);
235+
bool *changed = nullptr, bool *allErased = nullptr) {
236+
config.fold = true;
237+
return applyOpPatternsGreedily(ops, patterns, config, changed, allErased);
238+
}
201239

202240
} // namespace mlir
203241

mlir/lib/CAPI/Transforms/Rewrite.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ MlirLogicalResult
289289
mlirApplyPatternsAndFoldGreedily(MlirModule op,
290290
MlirFrozenRewritePatternSet patterns,
291291
MlirGreedyRewriteDriverConfig) {
292-
return wrap(
293-
mlir::applyPatternsAndFoldGreedily(unwrap(op), *unwrap(patterns)));
292+
return wrap(mlir::applyPatternsGreedily(unwrap(op), *unwrap(patterns)));
294293
}
295294

296295
//===----------------------------------------------------------------------===//

mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,6 @@ void ArithToAMDGPUConversionPass::runOnOperation() {
385385
arith::populateArithToAMDGPUConversionPatterns(
386386
patterns, convertFP8Arithmetic, saturateFP8Truncf, allowPackedF16Rtz,
387387
*maybeChipset);
388-
if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns))))
388+
if (failed(applyPatternsGreedily(op, std::move(patterns))))
389389
return signalPassFailure();
390390
}

mlir/lib/Conversion/ArithToArmSME/ArithToArmSME.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ struct ArithToArmSMEConversionPass final
117117
void runOnOperation() override {
118118
RewritePatternSet patterns(&getContext());
119119
arith::populateArithToArmSMEConversionPatterns(patterns);
120-
if (failed(
121-
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
120+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
122121
return signalPassFailure();
123122
}
124123
};

mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class ConvertArmNeon2dToIntr
5959
RewritePatternSet patterns(context);
6060
populateConvertArmNeon2dToIntrPatterns(patterns);
6161

62-
if (failed(
63-
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
62+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
6463
return signalPassFailure();
6564
}
6665
};

mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ struct LowerGpuOpsToNVVMOpsPass
271271
{
272272
RewritePatternSet patterns(m.getContext());
273273
populateGpuRewritePatterns(patterns);
274-
if (failed(applyPatternsAndFoldGreedily(m, std::move(patterns))))
274+
if (failed(applyPatternsGreedily(m, std::move(patterns))))
275275
return signalPassFailure();
276276
}
277277

mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ struct LowerGpuOpsToROCDLOpsPass
271271
RewritePatternSet patterns(ctx);
272272
populateGpuRewritePatterns(patterns);
273273
arith::populateExpandBFloat16Patterns(patterns);
274-
(void)applyPatternsAndFoldGreedily(m, std::move(patterns));
274+
(void)applyPatternsGreedily(m, std::move(patterns));
275275
}
276276

277277
LLVMTypeConverter converter(ctx, options);

mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,7 @@ struct ConvertMeshToMPIPass
427427
ConvertProcessLinearIndexOp, ConvertProcessMultiIndexOp>(
428428
ctx);
429429

430-
(void)mlir::applyPatternsAndFoldGreedily(getOperation(),
431-
std::move(patterns));
430+
(void)mlir::applyPatternsGreedily(getOperation(), std::move(patterns));
432431
}
433432
};
434433

mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ConvertShapeConstraints
6262
RewritePatternSet patterns(context);
6363
populateConvertShapeConstraintsConversionPatterns(patterns);
6464

65-
if (failed(applyPatternsAndFoldGreedily(func, std::move(patterns))))
65+
if (failed(applyPatternsGreedily(func, std::move(patterns))))
6666
return signalPassFailure();
6767
}
6868
};

mlir/lib/Conversion/VectorToArmSME/VectorToArmSMEPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void ConvertVectorToArmSMEPass::runOnOperation() {
3333
RewritePatternSet patterns(&getContext());
3434
populateVectorToArmSMEPatterns(patterns, getContext());
3535

36-
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
36+
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
3737
}
3838

3939
std::unique_ptr<Pass> mlir::createConvertVectorToArmSMEPass() {

mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,8 +1326,7 @@ struct ConvertVectorToGPUPass
13261326
void runOnOperation() override {
13271327
RewritePatternSet patterns(&getContext());
13281328
populatePrepareVectorToMMAPatterns(patterns, useNvGpu.getValue());
1329-
if (failed(
1330-
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
1329+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
13311330
return signalPassFailure();
13321331

13331332
IRRewriter rewriter(&getContext());

mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void ConvertVectorToLLVMPass::runOnOperation() {
8282
populateVectorInsertExtractStridedSliceTransforms(patterns);
8383
populateVectorStepLoweringPatterns(patterns);
8484
populateVectorRankReducingFMAPattern(patterns);
85-
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
85+
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
8686
}
8787

8888
// Convert to the LLVM IR dialect.

mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,12 +1730,12 @@ struct ConvertVectorToSCFPass
17301730
RewritePatternSet lowerTransferPatterns(&getContext());
17311731
mlir::vector::populateVectorTransferPermutationMapLoweringPatterns(
17321732
lowerTransferPatterns);
1733-
(void)applyPatternsAndFoldGreedily(getOperation(),
1734-
std::move(lowerTransferPatterns));
1733+
(void)applyPatternsGreedily(getOperation(),
1734+
std::move(lowerTransferPatterns));
17351735

17361736
RewritePatternSet patterns(&getContext());
17371737
populateVectorToSCFConversionPatterns(patterns, options);
1738-
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
1738+
(void)applyPatternsGreedily(getOperation(), std::move(patterns));
17391739
}
17401740
};
17411741

mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,7 @@ struct ConvertVectorToXeGPUPass
318318
void runOnOperation() override {
319319
RewritePatternSet patterns(&getContext());
320320
populateVectorToXeGPUConversionPatterns(patterns);
321-
if (failed(
322-
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
321+
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
323322
return signalPassFailure();
324323
}
325324
};

mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ SimplifyBoundedAffineOpsOp::apply(transform::TransformRewriter &rewriter,
132132
static_cast<RewriterBase::Listener *>(rewriter.getListener());
133133
config.strictMode = GreedyRewriteStrictness::ExistingAndNewOps;
134134
// Apply the simplification pattern to a fixpoint.
135-
if (failed(applyOpPatternsAndFold(targets, frozenPatterns, config))) {
135+
if (failed(applyOpPatternsGreedily(targets, frozenPatterns, config))) {
136136
auto diag = emitDefiniteFailure()
137137
<< "affine.min/max simplification did not converge";
138138
return diag;

mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,5 +239,5 @@ void AffineDataCopyGeneration::runOnOperation() {
239239
FrozenRewritePatternSet frozenPatterns(std::move(patterns));
240240
GreedyRewriteConfig config;
241241
config.strictMode = GreedyRewriteStrictness::ExistingAndNewOps;
242-
(void)applyOpPatternsAndFold(copyOps, frozenPatterns, config);
242+
(void)applyOpPatternsGreedily(copyOps, frozenPatterns, config);
243243
}

0 commit comments

Comments
 (0)