Deduplicate functions that are equivalent in all aspects but their symbol name.
The pass chooses one representative per equivalence class, erases the remainder, and updates function calls accordingly.
Depends On D144735
Paths
| Differential D144738
[MLIR] Add pass to deduplicate functions ClosedPublic Authored by frgossen on Feb 24 2023, 8:17 AM.
Details Summary Deduplicate functions that are equivalent in all aspects but their symbol name. Depends On D144735
Diff Detail
Event Timelinepifon2a added inline comments. This revision is now accepted and ready to land.Feb 26 2023, 11:08 PM This revision was landed with ongoing or failed builds.Feb 27 2023, 8:00 AM Closed by commit rGb12bcf3fb7fa: [MLIR] Add pass to deduplicate functions (authored by frgossen). · Explain Why This revision was automatically updated to reflect the committed changes.
Comment Actions Thanks for the comments. I addressed them in https://reviews.llvm.org/D146456.
I guess it could be generalized when needed.
Comment Actions I rather not write code that is over-restrictive unnecessarily (if you think about it, the entirety of MLIR exists because we generalize early, otherwise we'd have rebuilt LLVM or XLA ;) ) We have a significant amount of code written for func::FuncOp, but that predates the existence of the FunctionalInterface. I'm not aware of counter example to the "prefer FunctionalInterface instead of the concrete FuncOp when possible" guideline I have in mind at the moment, maybe @rriddle sees any?
Revision Contents
Diff 500216 mlir/include/mlir/Dialect/Func/Transforms/Passes.h
mlir/include/mlir/Dialect/Func/Transforms/Passes.td
mlir/lib/Dialect/Func/Transforms/CMakeLists.txt
mlir/lib/Dialect/Func/Transforms/DuplicateFunctionElimination.cpp
mlir/test/Dialect/Func/duplicate-function-elimination.mlir
|
Please switch this to using namespace mlir; instead of wrapping the file in a namespace.