[LoopUnroll] Fix a crash
authorSerguei Katkov <serguei.katkov@azul.com>
Tue, 22 Dec 2020 09:40:50 +0000 (16:40 +0700)
committerSerguei Katkov <serguei.katkov@azul.com>
Mon, 11 Jan 2021 03:19:26 +0000 (10:19 +0700)
commit7f69860243e8933c3da1177afde0d3cb6544d04e
tree7187bc7a1a30135ccc89c8b23c078e958878c441
parent5cf73dca77e52f54c893d2c5fc2f56a5f2764f7d
[LoopUnroll] Fix a crash

Loop peeling as a last step triggers loop simplification and this
can change the loop structure. As a result all cashed values like
latch branch becomes invalid.

Patch re-structure the code to take into account the possible
changes caused by peeling.

Reviewers: dmgreen, Meinersbur, etiotto, fhahn, efriedma, bmahjour
Reviewed By: Meinersbur, fhahn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D93686
llvm/lib/Transforms/Utils/LoopUnroll.cpp
llvm/test/Transforms/LoopUnroll/unroll-after-peel.ll [new file with mode: 0644]