[all-commits] [llvm/llvm-project] a9ab84: [MLIR][analysis] Fix error in the sparse backward ...

Srishti Srivastava via All-commits all-commits at lists.llvm.org
Fri Jul 28 23:31:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a9ab845cb17e01ba83404d0fc82ac523d9f8dad0
      https://github.com/llvm/llvm-project/commit/a9ab845cb17e01ba83404d0fc82ac523d9f8dad0
  Author: Srishti Srivastava <srishtisrivastava.ai at gmail.com>
  Date:   2023-07-29 (Sat, 29 Jul 2023)

  Changed paths:
    M mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h
    M mlir/lib/Analysis/DataFlow/LivenessAnalysis.cpp
    M mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
    M mlir/test/Analysis/DataFlow/test-liveness-analysis.mlir
    M mlir/test/Analysis/DataFlow/test-written-to.mlir

  Log Message:
  -----------
  [MLIR][analysis] Fix error in the sparse backward dataflow analysis

Earlier, in the sparse backward dataflow analysis, data from the results
of an op implementing `RegionBranchOpInterface` was considered to flow
into the operands of every op that did not implement the
`RegionBranchTerminatorOpInterface` but was return-like and present
in a region of the former. It was thus also expected that the number of
results of the former be equal to the number of operands in the latter.

This understanding of dataflow is incorrect and thus this expectation is
also not justified. This commit fixes this incorrect understanding.

This commit ensures that these return-like ops are handled just like the
ops implementing the `RegionBranchTerminatorOpInterface`, which means
that, if this op has a region `A` whose successors are regions `B`, `C`,
and `D`, then data flows from the arguments (successor inputs) of `B`,
`C`, and `D` to the corresponding successor operands of this op.

This fix is also propagated to liveness analysis that earlier relied on
this incorrect implementation of the sparse backward dataflow analysis
framework and corrects some incorrect assumptions made in it.

Also cleaned up some unnecessary comments from the test file.

Issue: https://github.com/llvm/llvm-project/issues/64139.

Signed-off-by: Srishti Srivastava <srishtisrivastava.ai at gmail.com>

Reviewed By: jcai19, matthiaskramm, Mogball

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




More information about the All-commits mailing list