[all-commits] [llvm/llvm-project] f178c1: [mlir] Support use-def cycles in graph regions dur...

Andrew Young via All-commits all-commits at lists.llvm.org
Thu Mar 18 23:07:04 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f178c13fa89960c7247a6367269919acf87fd1b3
      https://github.com/llvm/llvm-project/commit/f178c13fa89960c7247a6367269919acf87fd1b3
  Author: Andrew Young <youngar17 at gmail.com>
  Date:   2021-03-18 (Thu, 18 Mar 2021)

  Changed paths:
    M mlir/lib/Transforms/Utils/RegionUtils.cpp
    M mlir/test/Transforms/canonicalize-dce.mlir

  Log Message:
  -----------
  [mlir] Support use-def cycles in graph regions during regionDCE

When deleting operations in DCE, the algorithm uses a post-order walk of
the IR to ensure that value uses were erased before value defs. Graph
regions do not have the same structural invariants as SSA CFG, and this
post order walk could delete value defs before uses.  This problem is
guaranteed to occur when there is a cycle in the use-def graph.

This change stops DCE from visiting the operations and blocks in any
meaningful order.  Instead, we rely on explicitly dropping all uses of a
value before deleting it.

Reviewed By: mehdi_amini, rriddle

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




More information about the All-commits mailing list