[MLIR][Affine] Fix generateUnrolledLoop utility
authorAkshay Baviskar <akshay@polymagelabs.com>
Thu, 6 Apr 2023 05:20:51 +0000 (10:50 +0530)
committerUday Bondhugula <uday@polymagelabs.com>
Thu, 6 Apr 2023 15:48:56 +0000 (21:18 +0530)
commit186c3d6315f01669a46413df49d98366e33aa208
tree3ad2766b97266eea74edb35eb307ffd30b9a4bc5
parentd98e60069975e003ab5216b7ac7f64be0fd4ea01
[MLIR][Affine] Fix generateUnrolledLoop utility

generateUnrolledLoop was assuming that the yielded value is always generated in
the Block corresponding to the loop being unrolled. Thus, it was updating the
last yielded values with it's cloned value. However, if the yielded value is not
generated in the same Block then the cloned value and it's corresponding mapping
won't exist, resulting in a crash. Fix this.

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D146931
mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp
mlir/test/Dialect/SCF/loop-unroll.mlir