Skip to content

Commit

Permalink
Fix greedy rewriter deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
maerhart committed Jan 9, 2025
1 parent 54b7adb commit 268f861
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 26 deletions.
9 changes: 4 additions & 5 deletions lib/Conversion/LoopScheduleToCalyx/LoopScheduleToCalyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1510,11 +1510,10 @@ class LoopScheduleToCalyxPass
if (runOnce)
config.maxIterations = 1;

/// Can't return applyPatternsAndFoldGreedily. Root isn't
/// Can't return applyPatternsGreedily. Root isn't
/// necessarily erased so it will always return failed(). Instead,
/// forward the 'succeeded' value from PartialLoweringPatternBase.
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(pattern),
config);
(void)applyPatternsGreedily(getOperation(), std::move(pattern), config);
return partialPatternRes;
}

Expand Down Expand Up @@ -1642,8 +1641,8 @@ void LoopScheduleToCalyxPass::runOnOperation() {
RewritePatternSet cleanupPatterns(&getContext());
cleanupPatterns.add<calyx::MultipleGroupDonePattern,
calyx::NonTerminatingGroupDonePattern>(&getContext());
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(cleanupPatterns)))) {
if (failed(
applyPatternsGreedily(getOperation(), std::move(cleanupPatterns)))) {
signalPassFailure();
return;
}
Expand Down
9 changes: 4 additions & 5 deletions lib/Conversion/SCFToCalyx/SCFToCalyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2491,11 +2491,10 @@ class SCFToCalyxPass : public circt::impl::SCFToCalyxBase<SCFToCalyxPass> {
if (runOnce)
config.maxIterations = 1;

/// Can't return applyPatternsAndFoldGreedily. Root isn't
/// Can't return applyPatternsGreedily. Root isn't
/// necessarily erased so it will always return failed(). Instead,
/// forward the 'succeeded' value from PartialLoweringPatternBase.
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(pattern),
config);
(void)applyPatternsGreedily(getOperation(), std::move(pattern), config);
return partialPatternRes;
}

Expand Down Expand Up @@ -2818,8 +2817,8 @@ void SCFToCalyxPass::runOnOperation() {
RewritePatternSet cleanupPatterns(&getContext());
cleanupPatterns.add<calyx::MultipleGroupDonePattern,
calyx::NonTerminatingGroupDonePattern>(&getContext());
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(cleanupPatterns)))) {
if (failed(
applyPatternsGreedily(getOperation(), std::move(cleanupPatterns)))) {
signalPassFailure();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/AIG/Transforms/LowerVariadic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ void LowerVariadicPass::runOnOperation() {
populateLowerVariadicPatterns(patterns);
mlir::FrozenRewritePatternSet frozen(std::move(patterns));

if (failed(mlir::applyPatternsAndFoldGreedily(getOperation(), frozen)))
if (failed(mlir::applyPatternsGreedily(getOperation(), frozen)))
return signalPassFailure();
}
4 changes: 2 additions & 2 deletions lib/Dialect/AIG/Transforms/LowerWordToBits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void LowerWordToBitsPass::runOnOperation() {
// Use top-down traversal to reuse bits from `comb.concat`.
config.useTopDownTraversal = true;

if (failed(mlir::applyPatternsAndFoldGreedily(getOperation(), frozenPatterns,
config)))
if (failed(
mlir::applyPatternsGreedily(getOperation(), frozenPatterns, config)))
return signalPassFailure();
}
8 changes: 4 additions & 4 deletions lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,8 @@ void ArcCanonicalizerPass::runOnOperation() {
symbolPatterns.add<MemWritePortEnableAndMaskCanonicalizer>(
&getContext(), cache, names, statistics, arcMapping);

if (failed(mlir::applyPatternsAndFoldGreedily(
getOperation(), std::move(symbolPatterns), config)))
if (failed(mlir::applyPatternsGreedily(getOperation(),
std::move(symbolPatterns), config)))
return signalPassFailure();

numArcArgsRemoved = statistics.removeUnusedArcArgumentsPatternNumArgsRemoved;
Expand All @@ -817,8 +817,8 @@ void ArcCanonicalizerPass::runOnOperation() {
KeepOneVecOp>(&getContext());

// Don't test for convergence since it is often not reached.
(void)mlir::applyPatternsAndFoldGreedily(getOperation(), std::move(patterns),
config);
(void)mlir::applyPatternsGreedily(getOperation(), std::move(patterns),
config);
}

std::unique_ptr<mlir::Pass> arc::createArcCanonicalizerPass() {
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/Arc/Transforms/LatencyRetiming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void LatencyRetimingPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
patterns.add<LatencyRetimingPattern>(&getContext(), cache, statistics);

if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
return signalPassFailure();

numOpsRemoved = statistics.numOpsRemoved;
Expand Down
3 changes: 1 addition & 2 deletions lib/Dialect/ESI/Passes/ESILowerBundles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ void ESIBundlesPass::runOnOperation() {
RewritePatternSet patterns(&ctxt);
PackBundleOp::getCanonicalizationPatterns(patterns, &ctxt);
UnpackBundleOp::getCanonicalizationPatterns(patterns, &ctxt);
if (failed(mlir::applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns))))
if (failed(mlir::applyPatternsGreedily(getOperation(), std::move(patterns))))
signalPassFailure();

top.walk([&](PackBundleOp pack) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/FIRRTL/Transforms/Vectorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void VectorizationPass::runOnOperation() {
VectorCreateToLogicElementwise<XorPrimOp, ElementwiseXorPrimOp>>(
&getContext());
mlir::FrozenRewritePatternSet frozenPatterns(std::move(patterns));
(void)applyPatternsAndFoldGreedily(getOperation(), frozenPatterns);
(void)applyPatternsGreedily(getOperation(), frozenPatterns);
}

std::unique_ptr<mlir::Pass> circt::firrtl::createVectorizationPass() {
Expand Down
3 changes: 1 addition & 2 deletions lib/Dialect/Handshake/Transforms/SplitMerges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ struct HandshakeSplitMerges
patterns.insert<DeconstructCMergePattern, DeconstructMergePattern>(
&getContext());

if (failed(
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
signalPassFailure();
};
};
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/Verif/Transforms/LowerFormalToHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ void LowerFormalToHWPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
patterns.add<FormalOpRewritePattern>(patterns.getContext());

if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
signalPassFailure();
}
4 changes: 2 additions & 2 deletions lib/Transforms/MemoryBanking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ void MemoryBankingPass::runOnOperation() {

GreedyRewriteConfig config;
config.strictMode = GreedyRewriteStrictness::ExistingOps;
if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns),
config))) {
if (failed(
applyPatternsGreedily(getOperation(), std::move(patterns), config))) {
signalPassFailure();
}

Expand Down

0 comments on commit 268f861

Please sign in to comment.