aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-06-09 01:14:03 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-06-09 01:14:03 +0000
commit1eade9151310d1ca8fd18e932c9af2f8c1ac2f94 (patch)
tree20892ea591a89f069facbc8b5523788c9dec773e
parentc7f69b921ff8b2e06762055e159cce55cd5f406b (diff)
downloadllvm-1eade9151310d1ca8fd18e932c9af2f8c1ac2f94.zip
llvm-1eade9151310d1ca8fd18e932c9af2f8c1ac2f94.tar.gz
llvm-1eade9151310d1ca8fd18e932c9af2f8c1ac2f94.tar.bz2
Minor clean up in loopHasNoAbnormalExits; NFC
llvm-svn: 272238
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 867b051..dac3a32 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -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;
}