From f71d0fb825b9405a93d21e36e66bfa14201e2348 Mon Sep 17 00:00:00 2001 From: Andrew Young Date: Wed, 13 Nov 2024 23:51:14 -0800 Subject: [PATCH] [firtool] Run CSE on classes (#7814) This runs CSE on all operations underneath the circuit. This also moves it up before the rest of the FModule passes run, as the Any pipeline will not merge with them. --- lib/Firtool/Firtool.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Firtool/Firtool.cpp b/lib/Firtool/Firtool.cpp index 59a2f7b50667..db6a5973c5ae 100644 --- a/lib/Firtool/Firtool.cpp +++ b/lib/Firtool/Firtool.cpp @@ -59,16 +59,15 @@ LogicalResult firtool::populateCHIRRTLToLowFIRRTL(mlir::PassManager &pm, pm.nest().addPass(firrtl::createInjectDUTHierarchyPass()); + if (!opt.shouldDisableOptimization()) + pm.nest().nestAny().addPass(mlir::createCSEPass()); + pm.nest().nest().addPass( firrtl::createPassiveWiresPass()); pm.nest().nest().addPass( firrtl::createDropNamesPass(opt.getPreserveMode())); - if (!opt.shouldDisableOptimization()) - pm.nest().nest().addPass( - mlir::createCSEPass()); - pm.nest().nest().addPass( firrtl::createLowerCHIRRTLPass());