[all-commits] [llvm/llvm-project] 47bf3e: [mlir][dataflow] Remove Lattice::isUninitialized().

Zhixun Tan via All-commits all-commits at lists.llvm.org
Thu Sep 8 08:46:38 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 47bf3e3812bc0e718b345857959333497cd12230
      https://github.com/llvm/llvm-project/commit/47bf3e3812bc0e718b345857959333497cd12230
  Author: Zhixun Tan <phisiart at gmail.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M mlir/include/mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h
    M mlir/include/mlir/Analysis/DataFlow/DeadCodeAnalysis.h
    M mlir/include/mlir/Analysis/DataFlow/IntegerRangeAnalysis.h
    M mlir/include/mlir/Analysis/DataFlow/SparseAnalysis.h
    M mlir/include/mlir/Analysis/DataFlowFramework.h
    M mlir/lib/Analysis/DataFlow/ConstantPropagationAnalysis.cpp
    M mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
    M mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp
    M mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp
    M mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
    M mlir/lib/Transforms/SCCP.cpp
    M mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp
    M mlir/test/lib/Analysis/TestDataFlowFramework.cpp
    M mlir/test/lib/Transforms/TestIntRangeInference.cpp

  Log Message:
  -----------
  [mlir][dataflow] Remove Lattice::isUninitialized().

Currently, for sparse analyses, we always store a `Optional<ValueT>` in each lattice element. When it's `None`, we consider the lattice element as `uninitialized`.

However:

* Not all lattices have an `uninitialized` state. For example, `Executable` and `PredecessorState` have default values so they are always initialized.

* In dense analyses, we don't have the concept of an `uninitialized` state.

Given these inconsistencies, this patch removes `Lattice::isUninitialized()`. Individual analysis states are now default-constructed. If the default state of an analysis can be considered as "uninitialized" then this analysis should implement the following logic:

* Special join rule: `join(uninitialized, any) == any`.

* Special bail out logic: if any of the input states is uninitialized, exit the transfer function early.

Depends On D132086

Reviewed By: Mogball

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




More information about the All-commits mailing list