[LoopUnroll] Don't peel loops where the latch isn't the exiting block
Peeling assumed this doesn't happen, but didn't check it. This fixes PR32178. Differential Revision: https://reviews.llvm.org/D30757 llvm-svn: 297993
This commit is contained in:
@@ -56,6 +56,13 @@ static bool canPeel(Loop *L) {
|
||||
if (!L->getExitingBlock() || !L->getUniqueExitBlock())
|
||||
return false;
|
||||
|
||||
// Don't try to peel loops where the latch is not the exiting block.
|
||||
// This can be an indication of two different things:
|
||||
// 1) The loop is not rotated.
|
||||
// 2) The loop contains irreducible control flow that involves the latch.
|
||||
if (L->getLoopLatch() != L->getExitingBlock())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user