diff --git a/mlir/include/mlir/Transforms/Passes.td b/mlir/include/mlir/Transforms/Passes.td --- a/mlir/include/mlir/Transforms/Passes.td +++ b/mlir/include/mlir/Transforms/Passes.td @@ -212,6 +212,10 @@ information on `Symbols`. }]; let constructor = "mlir::createSymbolDCEPass()"; + + let statistics = [ + Statistic<"numDCE", "num-dce'd", "Number of symbols DCE'd">, + ]; } def SymbolPrivatize : Pass<"symbol-privatize"> { diff --git a/mlir/lib/Transforms/SymbolDCE.cpp b/mlir/lib/Transforms/SymbolDCE.cpp --- a/mlir/lib/Transforms/SymbolDCE.cpp +++ b/mlir/lib/Transforms/SymbolDCE.cpp @@ -62,8 +62,10 @@ return; for (auto &block : nestedSymbolTable->getRegion(0)) { for (Operation &op : llvm::make_early_inc_range(block)) { - if (isa(&op) && !liveSymbols.count(&op)) + if (isa(&op) && !liveSymbols.count(&op)) { op.erase(); + ++numDCE; + } } } });