ConvertToCFG: handle loop 1D affine loop bounds.
authorAlex Zinenko <zinenko@google.com>
Tue, 20 Nov 2018 19:15:03 +0000 (11:15 -0800)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 21:03:20 +0000 (14:03 -0700)
commitf986d5920b1cbd17e9d7e49974d822d5adc68579
tree3f817c6a0fe2f7803f428344f8a30b1a5dc75f44
parent85f86ca2034c370ae7dac5fb8a29e4219be55219
ConvertToCFG: handle loop 1D affine loop bounds.

In the general case, loop bounds can be expressed as affine maps of the outer
loop iterators and function arguments.  Relax the check for loop bounds to be
known integer constants and also accept one-dimensional affine bounds in
ConvertToCFG ForStmt lowering.  Emit affine_apply operations for both the upper
and the lower bound.  The semantics of MLFunctions guarantees that both bounds
can be computed before the loop starts iterating.  Constant bounds are merely a
short-hand notation for zero-dimensional affine maps and get supported
transparently.

Multidimensional affine bounds are not yet supported because the target IR
dialect lacks min/max operations necessary to implement the corresponding
semantics.

PiperOrigin-RevId: 222275801
mlir/lib/Transforms/ConvertToCFG.cpp
mlir/test/Transforms/convert2cfg.mlir