[MLIR][Affine] Add affine.for normalization support
authorNavdeep Kumar <navdeep.navdeep37@gmail.com>
Mon, 7 Dec 2020 09:27:51 +0000 (14:57 +0530)
committerUday Bondhugula <uday@polymagelabs.com>
Mon, 7 Dec 2020 16:34:07 +0000 (22:04 +0530)
commitdc930e5f2f91e7eb5ebc9cb61f6a71bc8924559e
tree680a19559aed28ae3a59aaa0cbff656c23e9bdd0
parent3d8b7465c338c53b4950ecaaa074259dcbc8939e
[MLIR][Affine] Add affine.for normalization support

Add support to normalize affine.for ops i.e., convert the lower bound to zero
and loop step to one. The Upper bound is set to the trip count of the loop.
The exact value of loopIV is calculated just inside the body of affine.for.
Currently loops with lower bounds having single result are supported. No such
restriction exists on upper bounds.

Differential Revision: https://reviews.llvm.org/D92233
mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
mlir/test/Dialect/Affine/affine-loop-normalize.mlir