[LoopUnroll] Add check to Latch's terminator in UnrollRuntimeLoopRemainder
commit50bc8f679d6d92c46f428b2d106056252fbf2849
authorDavid Green <david.green@arm.com>
Tue, 25 Sep 2018 10:08:47 +0000 (25 10:08 +0000)
committerDavid Green <david.green@arm.com>
Tue, 25 Sep 2018 10:08:47 +0000 (25 10:08 +0000)
tree694b5cefd34b56df6ab7e9de8f43397c286108fe
parent116128c1c03ba2f34f01209184327a49844982fa
[LoopUnroll] Add check to Latch's terminator in UnrollRuntimeLoopRemainder

In this patch, I'm adding an extra check to the Latch's terminator in llvm::UnrollRuntimeLoopRemainder,
similar to how it is already done in the llvm::UnrollLoop.

The compiler would crash if this function is called with a malformed loop.

Patch by Rodrigo Caetano Rocha!

Differential Revision: https://reviews.llvm.org/D51486

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342958 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LoopUnrollRuntime.cpp
test/Transforms/LoopUnroll/runtime-loop-non-exiting-latch.ll [new file with mode: 0644]
unittests/Transforms/Utils/CMakeLists.txt
unittests/Transforms/Utils/UnrollLoopTest.cpp [new file with mode: 0644]