[mlir] Extend AffineForEmptyLoopFolder
authorAmy Zhuang <amy.zhuang@intel.com>
Wed, 9 Mar 2022 01:17:22 +0000 (17:17 -0800)
committerAmy Zhuang <amy.zhuang@intel.com>
Wed, 9 Mar 2022 01:17:22 +0000 (17:17 -0800)
commit6edfb628f9cc1008d6d0dd7719483458a324daa8
tree8975332000537713e9e2ea271b6f35cada31f8e9
parent53cc3a06378229f5b4713f0db39135e846609d0a
[mlir] Extend AffineForEmptyLoopFolder

Currently when we fold an empty loop, we assume that any loop
with iterArgs returns its iterArgs in order, which is not always
the case. It may return values defined outside of the loop or
return its iterArgs out of order. This patch adds support to
those cases.

Reviewed By: dcaballe

Differential Revision: https://reviews.llvm.org/D120776
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/test/Dialect/Affine/canonicalize.mlir