diff options
author | Joerg Sonnenberger <joerg@bec.de> | 2015-03-09 20:26:36 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@bec.de> | 2015-03-09 20:26:36 +0000 |
commit | f9ec3cff53ccd3fa1d0a76ffb02bdb83bec40b68 (patch) | |
tree | ccc6c6b05289de61a9aa4c4f22b89799a74a6cc9 | |
parent | c583e8421f66785a780b1cc8505c06e8fef917fc (diff) | |
download | llvm-f9ec3cff53ccd3fa1d0a76ffb02bdb83bec40b68.tar.gz |
Merging r230058 by d0k:
LoopRotate: When reconstructing loop simplify form don't split edges
from indirectbrs.
Yet another chapter in the endless story. While this looks like we leave
the loop in a non-canonical state this replicates the logic in
LoopSimplify so it doesn't diverge from the canonical form in any way.
PR21968
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_36@231698 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/LoopRotation.cpp | 2 | ||||
-rw-r--r-- | test/Transforms/LoopRotate/crash.ll | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 9164be22465..267cb999d24 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -535,6 +535,8 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { Loop *PredLoop = LI->getLoopFor(*PI); if (!PredLoop || PredLoop->contains(Exit)) continue; + if (isa<IndirectBrInst>((*PI)->getTerminator())) + continue; SplitLatchEdge |= L->getLoopLatch() == *PI; BasicBlock *ExitSplit = SplitCriticalEdge(*PI, Exit, this); ExitSplit->moveBefore(Exit); diff --git a/test/Transforms/LoopRotate/crash.ll b/test/Transforms/LoopRotate/crash.ll index fd922cb5569..e95f9a1f350 100644 --- a/test/Transforms/LoopRotate/crash.ll +++ b/test/Transforms/LoopRotate/crash.ll @@ -153,3 +153,21 @@ entry: "5": ; preds = %"3", %entry ret void } + +; PR21968 +define void @test8(i1 %C, i8* %P) #0 { +entry: + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + br i1 %C, label %l_bad, label %for.body + +for.body: ; preds = %for.cond + indirectbr i8* %P, [label %for.inc, label %l_bad] + +for.inc: ; preds = %for.body + br label %for.cond + +l_bad: ; preds = %for.body, %for.cond + ret void +} |