[LoopRotate] Fix DomTree update logic for unreachable nodes. Fix PR33701.
authorJakub Kuderski <kubakuderski@gmail.com>
Wed, 12 Jul 2017 18:42:16 +0000 (18:42 +0000)
committerJakub Kuderski <kubakuderski@gmail.com>
Wed, 12 Jul 2017 18:42:16 +0000 (18:42 +0000)
commitb323f4f173710c60bcc76628d8155e476023c5b5
tree56e0c010a71bfe43ec9796ba32bd90ff47f30fe0
parent5ae1bfe813126dc68fe1b9f572d0bd59d481feca
[LoopRotate] Fix DomTree update logic for unreachable nodes. Fix PR33701.

Summary:
LoopRotate manually updates the DoomTree by iterating over all predecessors of a basic block and computing the Nearest Common Dominator.

When a predecessor happens to be unreachable, `DT.findNearestCommonDominator` returns nullptr.

This patch teaches LoopRotate to handle this case and fixes [[ https://bugs.llvm.org/show_bug.cgi?id=33701 | PR33701 ]].

In the future, LoopRotate should be taught to use the new incremental API for updating the DomTree.

Reviewers: dberlin, davide, uabelho, grosser

Subscribers: efriedma, mzolotukhin

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

llvm-svn: 307828
llvm/lib/Transforms/Scalar/LoopRotation.cpp
llvm/test/Transforms/LoopRotate/pr33701.ll [new file with mode: 0644]