summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2019-03-06 23:04:40 +0000
committerNick Desaulniers <ndesaulniers@google.com>2019-03-06 23:04:40 +0000
commit212c8ac23f4f3313c847eb42cac1088cc4c3d39f (patch)
tree19e813e245827d3d5452b1f23c8e89a40a94a20d /llvm/lib
parent10454dcc6a806cc17fc8276d0b595c84be29460f (diff)
downloadbcm5719-llvm-212c8ac23f4f3313c847eb42cac1088cc4c3d39f.tar.gz
bcm5719-llvm-212c8ac23f4f3313c847eb42cac1088cc4c3d39f.zip
[LoopRotate] fix crash encountered with callbr
Summary: While implementing inlining support for callbr (https://bugs.llvm.org/show_bug.cgi?id=40722), I hit a crash in Loop Rotation when trying to build the entire x86 Linux kernel (drivers/char/random.c). This is a small fix up to r353563. Test case is drivers/char/random.c (with callbr's inlined), then ran through creduce, then `opt -opt-bisect-limit=<limit>`, then bugpoint. Thanks to Craig Topper for immediately spotting the fix, and teaching me how to fish. Reviewers: craig.topper, jyknight Reviewed By: craig.topper Subscribers: hiraditya, llvm-commits, srhines Tags: #llvm Differential Revision: https://reviews.llvm.org/D58929 llvm-svn: 355564
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Utils/LoopRotationUtils.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index a38d34932e1..88c4937cfe1 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -462,9 +462,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
for (BasicBlock *ExitPred : ExitPreds) {
// We only need to split loop exit edges.
Loop *PredLoop = LI->getLoopFor(ExitPred);
- if (!PredLoop || PredLoop->contains(Exit))
- continue;
- if (isa<IndirectBrInst>(ExitPred->getTerminator()))
+ if (!PredLoop || PredLoop->contains(Exit) ||
+ ExitPred->getTerminator()->isIndirectTerminator())
continue;
SplitLatchEdge |= L->getLoopLatch() == ExitPred;
BasicBlock *ExitSplit = SplitCriticalEdge(
OpenPOWER on IntegriCloud