summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2017-03-16 21:07:48 +0000
committerMichael Kuperstein <mkuper@google.com>2017-03-16 21:07:48 +0000
commit2da2bfa088e9bf344a3ae7710dea518766cc730c (patch)
tree4215783100e213561426eda4df9d4531853a4c05 /llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
parent99de88d1f3f095ccf0d978a1d3c2b84147420353 (diff)
downloadbcm5719-llvm-2da2bfa088e9bf344a3ae7710dea518766cc730c.tar.gz
bcm5719-llvm-2da2bfa088e9bf344a3ae7710dea518766cc730c.zip
[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
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
index b8147fcb697..ea3e37d9c59 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -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;
}
OpenPOWER on IntegriCloud