[all-commits] [llvm/llvm-project] c8457e: [mlir][transforms] Add a topological sort utility ...

Jeff Niu via All-commits all-commits at lists.llvm.org
Mon May 16 13:47:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8457eb5323ca99361c1748a22a16edb3160ae5f
      https://github.com/llvm/llvm-project/commit/c8457eb5323ca99361c1748a22a16edb3160ae5f
  Author: Mogball <jeffniu22 at gmail.com>
  Date:   2022-05-16 (Mon, 16 May 2022)

  Changed paths:
    M mlir/include/mlir/Transforms/Passes.h
    M mlir/include/mlir/Transforms/Passes.td
    A mlir/include/mlir/Transforms/TopologicalSortUtils.h
    M mlir/lib/Transforms/CMakeLists.txt
    A mlir/lib/Transforms/TopologicalSort.cpp
    M mlir/lib/Transforms/Utils/CMakeLists.txt
    A mlir/lib/Transforms/Utils/TopologicalSortUtils.cpp
    A mlir/test/Transforms/test-toposort.mlir

  Log Message:
  -----------
  [mlir][transforms] Add a topological sort utility and pass

This patch adds a topological sort utility and pass. A topological sort reorders
the operations in a block without SSA dominance such that, as much as possible,
users of values come after their producers.

The utility function sorts topologically the operation range in a given block
with an optional user-provided callback that can be used to virtually break cycles.
The toposort pass itself recursively sorts graph regions under the target op.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D125063




More information about the All-commits mailing list