[mlir][scf] Add general affine.min canonicalization pattern
authorMatthias Springer <springerm@google.com>
Tue, 24 Aug 2021 12:21:12 +0000 (21:21 +0900)
committerMatthias Springer <springerm@google.com>
Tue, 24 Aug 2021 22:32:30 +0000 (07:32 +0900)
commit98aa694d0d731307bf83d289803f57886d2d3aaa
tree112f7b1c77700d82c0e874c981e756977f268ed2
parent120d97b1a7a81561bb02fc7cd5dc304ef5cbe1cf
[mlir][scf] Add general affine.min canonicalization pattern

This canonicalization simplifies affine.min operations inside "for loop"-like operations (e.g., scf.for and scf.parallel) based on two invariants:
* iv >= lb
* iv < lb + step * ((ub - lb - 1) floorDiv step) + 1

This commit adds a new pass `canonicalize-scf-affine-min` (instead of being a canonicalization pattern) to avoid dependencies between the Affine dialect and the SCF dialect.

Differential Revision: https://reviews.llvm.org/D107731
mlir/include/mlir/Dialect/SCF/Passes.h
mlir/include/mlir/Dialect/SCF/Passes.td
mlir/include/mlir/Dialect/SCF/Transforms.h
mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
mlir/test/Dialect/SCF/canonicalize-scf-affine-min.mlir [new file with mode: 0644]
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel