Skip to content

Commit 7900256

Browse files
committed
Remove runOn
1 parent c7ffde4 commit 7900256

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ class DeclareOpConversion : public mlir::OpRewritePattern<fir::DeclareOp> {
283283

284284
class CodeGenRewrite : public fir::impl::CodeGenRewriteBase<CodeGenRewrite> {
285285
public:
286-
void runOn(mlir::Operation *op) {
286+
void runOnOperation() override final {
287+
mlir::ModuleOp mod = getOperation();
288+
287289
auto &context = getContext();
288290
mlir::ConversionTarget target(context);
289291
target.addLegalDialect<mlir::arith::ArithDialect, fir::FIROpsDialect,
@@ -301,21 +303,15 @@ class CodeGenRewrite : public fir::impl::CodeGenRewriteBase<CodeGenRewrite> {
301303
patterns.insert<EmboxConversion, ArrayCoorConversion, ReboxConversion,
302304
DeclareOpConversion>(&context);
303305
if (mlir::failed(
304-
mlir::applyPartialConversion(op, target, std::move(patterns)))) {
306+
mlir::applyPartialConversion(mod, target, std::move(patterns)))) {
305307
mlir::emitError(mlir::UnknownLoc::get(&context),
306308
"error in running the pre-codegen conversions");
307309
signalPassFailure();
308310
return;
309311
}
310312
// Erase any residual (fir.shape, fir.slice...).
311313
mlir::IRRewriter rewriter(&context);
312-
(void)mlir::runRegionDCE(rewriter, op->getRegions());
313-
}
314-
315-
void runOnOperation() override final {
316-
// Call runOn on all top level regions that may contain emboxOp/arrayCoorOp.
317-
mlir::ModuleOp mod = getOperation();
318-
runOn(mod);
314+
(void)mlir::runRegionDCE(rewriter, mod->getRegions());
319315
}
320316
};
321317

0 commit comments

Comments
 (0)