diff --git a/lib/Transform/Noisy/ReduceNoiseOptimizer.cpp b/lib/Transform/Noisy/ReduceNoiseOptimizer.cpp index 26fe070..3591fa5 100644 --- a/lib/Transform/Noisy/ReduceNoiseOptimizer.cpp +++ b/lib/Transform/Noisy/ReduceNoiseOptimizer.cpp @@ -17,7 +17,18 @@ struct ReduceNoiseOptimizer : impl::ReduceNoiseOptimizerBase { using ReduceNoiseOptimizerBase::ReduceNoiseOptimizerBase; - void runOnOperation() { ReduceNoiseAnalysis analysis(getOperation()); } + void runOnOperation() { + // FIXME: Should have some way to mark failure + ReduceNoiseAnalysis analysis(getOperation()); + + getOperation()->walk([&](Operation *op) { + if (analysis.shouldInsertReduceNoise(op)) { + OpBuilder builder(getOperation()); + auto reduceOp = builder.create(op->getLoc(), op->getResult(0)); + op->getResult(0).replaceAllUsesWith(reduceOp.getResult()); + } + }); + } }; } // namespace noisy