[mlir][transforms] Add topological sort analysis
authorMatthias Springer <springerm@google.com>
Mon, 15 Aug 2022 19:04:25 +0000 (21:04 +0200)
committerMatthias Springer <springerm@google.com>
Mon, 15 Aug 2022 19:09:18 +0000 (21:09 +0200)
commit31fbdab376a4f90d793d16d4a4523be7d30d2604
tree38d2b931917103d2c965ff2eb566448aab674d37
parente86119b4ff42426474828a558d9e5dedb09c4330
[mlir][transforms] Add topological sort analysis

This change add a helper function for computing a topological sorting of a list of ops. E.g. this can be useful in transforms where a subset of ops should be cloned without dominance errors.

The analysis reuses the existing implementation in TopologicalSortUtils.cpp.

Differential Revision: https://reviews.llvm.org/D131669
mlir/include/mlir/Transforms/TopologicalSortUtils.h
mlir/lib/Transforms/Utils/TopologicalSortUtils.cpp
mlir/test/Transforms/test-toposort.mlir
mlir/test/lib/Transforms/CMakeLists.txt
mlir/test/lib/Transforms/TestTopologicalSort.cpp [new file with mode: 0644]
mlir/tools/mlir-opt/mlir-opt.cpp