[LoopSimplify] Simplify how we compute UniqueExit

Summary: Simplify how we compute UniqueExit. Reuse ExitBlockSet.

Reviewers: sanjoy, efriedma, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Xin Tong 2017-02-21 19:10:58 +00:00
parent fbff24df0b
commit 141d242f5a

View File

@ -645,14 +645,7 @@ ReprocessLoop:
// loop-invariant instructions out of the way to open up more
// opportunities, and the disadvantage of having the responsibility
// to preserve dominator information.
bool UniqueExit = true;
if (!ExitBlocks.empty())
for (unsigned i = 1, e = ExitBlocks.size(); i != e; ++i)
if (ExitBlocks[i] != ExitBlocks[0]) {
UniqueExit = false;
break;
}
if (UniqueExit) {
if (ExitBlockSet.size() == 1) {
for (unsigned i = 0, e = ExitingBlocks.size(); i != e; ++i) {
BasicBlock *ExitingBlock = ExitingBlocks[i];
if (!ExitingBlock->getSinglePredecessor()) continue;