Minor clean up in loopHasNoAbnormalExits; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272238 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjoy Das 2016-06-09 01:14:03 +00:00
parent 05c5b3fd8e
commit 0c3d257062

View File

@ -4912,15 +4912,14 @@ bool ScalarEvolution::isAddRecNeverPoison(const Instruction *I, const Loop *L) {
bool ScalarEvolution::loopHasNoAbnormalExits(const Loop *L) {
auto Itr = LoopHasNoAbnormalExits.find(L);
if (Itr == LoopHasNoAbnormalExits.end()) {
bool HasAbnormalExit = false;
for (auto *BB : L->getBlocks()) {
HasAbnormalExit = any_of(*BB, [](Instruction &I) {
return !isGuaranteedToTransferExecutionToSuccessor(&I);
auto NoAbnormalExitInBB = [&](BasicBlock *BB) {
return all_of(*BB, [](Instruction &I) {
return isGuaranteedToTransferExecutionToSuccessor(&I);
});
if (HasAbnormalExit)
break;
}
auto InsertPair = LoopHasNoAbnormalExits.insert({L, !HasAbnormalExit});
};
auto InsertPair = LoopHasNoAbnormalExits.insert(
{L, all_of(L->getBlocks(), NoAbnormalExitInBB)});
assert(InsertPair.second && "We just checked!");
Itr = InsertPair.first;
}