Fixes a bug in formation and simplification of an epilogue loop generated
during loop unroll of scf::ForOp (https://bugs.llvm.org/show_bug.cgi?id=46689)
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/test/Transforms/scf-loop-unroll.mlir | ||
---|---|---|
2 | Can you remove the -allow-unregistered-dialect here and use std.add (or another test operation), and same for types? |
mlir/lib/Transforms/Utils/LoopUtils.cpp | ||
---|---|---|
217 | Nit: consider using getTerminator() instead of back() for better readability. | |
mlir/test/Transforms/scf-loop-unroll.mlir | ||
9 | Could you make it 11 iterations to make the test stronger (or an additional one if you prefer)? Is coverage missing for a symbolic upper bound in the presence of return values? |
mlir/test/Transforms/scf-loop-unroll.mlir | ||
---|---|---|
9 | I believe the crash from PR46689 only exists when the epilogue has a single iteration |
Update: Fix handling of loop carried variables inside the loop.
This update addresses reviewer comments and fixes another, previously undetected bug:
- Loop carried variables are now correctly propagated during unrolling the body of the loop.
- Added another test with symbolic upper bound and multiple loop-carried variables.
mlir/test/Transforms/scf-loop-unroll.mlir | ||
---|---|---|
9 | I added another test with a symbolic upper bound and multiple carried values to test the case when epilogue loop is not unrolled. It does not trigger crash from PR46689, but good to have as additional coverage. |
Seems like you uploaded the same diff as before, you may want to double-check and retry here?
Remove changes pulled in from unrelated updates to mlir/lib/Transforms/Utils/LoopUtils.cpp
LGTM again, thanks. You probably should wait one or two days to give a change to Uday to check again.
Nit: consider using getTerminator() instead of back() for better readability.