[all-commits] [llvm/llvm-project] 232f8e: [MLIR][analysis] Fix call op handling in sparse ba...

Srishti Srivastava via All-commits all-commits at lists.llvm.org
Fri Aug 11 10:27:14 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 232f8eadae18889627bdca75c45e98b0c1460086
      https://github.com/llvm/llvm-project/commit/232f8eadae18889627bdca75c45e98b0c1460086
  Author: Srishti Srivastava <srishtisrivastava.ai at gmail.com>
  Date:   2023-08-11 (Fri, 11 Aug 2023)

  Changed paths:
    M mlir/include/mlir/Analysis/DataFlow/LivenessAnalysis.h
    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
    M mlir/test/lib/Analysis/DataFlow/TestSparseBackwardDataFlowAnalysis.cpp
    M mlir/test/lib/Dialect/Test/TestDialect.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td

  Log Message:
  -----------
  [MLIR][analysis] Fix call op handling in sparse backward dataflow

Currently, data in `AbstractSparseBackwardDataFlowAnalysis` is
considered to flow one-to-one, in order, from the operands of an op
implementing `CallOpInterface` to the arguments of the function it is
calling.

This understanding of the data flow is inaccurate. The operands of such
an op that forward to the function arguments are obtained using a
method provided by `CallOpInterface` called `getArgOperands()`.

This commit fixes this bug by using `getArgOperands()` instead of
`getOperands()` to get the mapping from operands to function arguments
because not all operands necessarily forward to the function arguments
and even if they do, they don't necessarily have to be in the order in
which they appear in the op. The operands that don't get forwarded are
handled by the newly introduced `visitCallOperand()` function, which
works analogous to the `visitBranchOperand()` function.

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.

Extra cleanup: Improved a comment and removed an unnecessary code line.

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

Reviewed By: matthiaskramm, jcai19

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




More information about the All-commits mailing list