[PATCH] D103700: [LV] Fix bug when unrolling (only) a loop with non-latch exit

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 4 08:50:33 PDT 2021


reames created this revision.
reames added reviewers: fhahn, stefanp, Ayal.
Herald added subscribers: zzheng, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

If we unroll a loop in the vectorizer (without vectorizing), and the cost model requires a epilogue be generated for correctness, the code generation must actually do so.

The included test case on an unmodified opt will access memory one past the expected bound.

I believe this to be the root cause of the issues seen with 3e5ce49e <https://reviews.llvm.org/rG3e5ce49e5371ce4feadbf97dd5c2b652d9db3d1d>, but even if it isn't, it's definitely a bug.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D103700

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/unroll_nonlatch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103700.349884.patch
Type: text/x-patch
Size: 5830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210604/bb853f96/attachment.bin>


More information about the llvm-commits mailing list