From 2524321968af20787b17a00aa0ade44bd274fa25 Mon Sep 17 00:00:00 2001 From: Soren Lassen Date: Tue, 12 Sep 2023 10:52:22 -0700 Subject: [PATCH] deduplicate getConstPropPatterns() implementation Signed-off-by: Soren Lassen --- src/Transform/ONNX/ConstProp.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Transform/ONNX/ConstProp.cpp b/src/Transform/ONNX/ConstProp.cpp index 14c3633d38..b80b9c9ba8 100644 --- a/src/Transform/ONNX/ConstProp.cpp +++ b/src/Transform/ONNX/ConstProp.cpp @@ -1013,12 +1013,6 @@ class SplitOfConst : public OpRewritePattern { } }; -void getPatterns(RewritePatternSet &patterns) { - populateWithGenerated(patterns); - if (isNotDisabled("SplitOfConst")) - patterns.insert(patterns.getContext()); -} - //===----------------------------------------------------------------------===// // Code to manage the pass. //===----------------------------------------------------------------------===// @@ -1042,7 +1036,7 @@ void ConstPropONNXToONNXPass::runOnOperation() { MLIRContext *context = &getContext(); RewritePatternSet patterns(context); - getPatterns(patterns); + getConstPropPatterns(patterns); if (failed(applyPatternsAndFoldGreedily(function, std::move(patterns)))) signalPassFailure(); } @@ -1050,7 +1044,9 @@ void ConstPropONNXToONNXPass::runOnOperation() { } // end anonymous namespace. void onnx_mlir::getConstPropPatterns(RewritePatternSet &patterns) { - getPatterns(patterns); + populateWithGenerated(patterns); + if (isNotDisabled("SplitOfConst")) + patterns.insert(patterns.getContext()); } void onnx_mlir::configureConstPropONNXToONNXPass(