Skip to content

Commit

Permalink
[mlir][SymbolDCE] Track the number of symbols DCE'd
Browse files Browse the repository at this point in the history
Added a statistic counting the number of erased symbols.

Differential Revision: https://reviews.llvm.org/D121930
  • Loading branch information
nandor committed Mar 18, 2022
1 parent c975668 commit 1ebf1af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions mlir/include/mlir/Transforms/Passes.td
Expand Up @@ -212,6 +212,10 @@ def SymbolDCE : Pass<"symbol-dce"> {
information on `Symbols`.
}];
let constructor = "mlir::createSymbolDCEPass()";

let statistics = [
Statistic<"numDCE", "num-dce'd", "Number of symbols DCE'd">,
];
}

def SymbolPrivatize : Pass<"symbol-privatize"> {
Expand Down
4 changes: 3 additions & 1 deletion mlir/lib/Transforms/SymbolDCE.cpp
Expand Up @@ -62,8 +62,10 @@ void SymbolDCE::runOnOperation() {
return;
for (auto &block : nestedSymbolTable->getRegion(0)) {
for (Operation &op : llvm::make_early_inc_range(block)) {
if (isa<SymbolOpInterface>(&op) && !liveSymbols.count(&op))
if (isa<SymbolOpInterface>(&op) && !liveSymbols.count(&op)) {
op.erase();
++numDCE;
}
}
}
});
Expand Down

0 comments on commit 1ebf1af

Please sign in to comment.