[all-commits] [llvm/llvm-project] 437352: Simplify affine bound min or max with operands

Uday Bondhugula via All-commits all-commits at lists.llvm.org
Fri Apr 28 18:50:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 43735204d59a87e40893460f3a05d80010184f77
      https://github.com/llvm/llvm-project/commit/43735204d59a87e40893460f3a05d80010184f77
  Author: Uday Bondhugula <uday at polymagelabs.com>
  Date:   2023-04-29 (Sat, 29 Apr 2023)

  Changed paths:
    M mlir/lib/Dialect/Affine/IR/AffineOps.cpp
    M mlir/test/Dialect/Affine/canonicalize.mlir

  Log Message:
  -----------
  Simplify affine bound min or max with operands

Add canonicalization for affine.for bounds to use operand info (when
operands are outer loop affine.for IVs) to simplify bounds: redundant
bound expressions are eliminated in specific cases that are easy to
check and well-suited for op canonicaliation. If the lowest or the
highest value the affine expression can take is already covered by other
constant bounds, the expression can be removed.

Eg:
`min (d0) -> (32 * d0 + 32, 32)(%i) where 0 <= %i < 2`

The first expression can't be less than 32 and can be simplified away
with a lightweight local rewrite.

This simplification being part of canonicalization only handles simple
expressions, specifically, a sum of products of operands with constants.
This is a very common and a dominant case where such simplification is
desired. These can be flattened without any local variables.

Reviewed By: dcaballe, springerm

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




More information about the All-commits mailing list