diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-05-03 17:50:06 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-05-03 17:50:06 +0000 |
| commit | 7e7a5a050ab4f424a2a5832567f3ee2093aa0926 (patch) | |
| tree | a423efdb48194731e39dfea0a679941ec975bc9c /llvm/lib/Transforms | |
| parent | 905fc27ebf9ec5a262dc320bb66e68f17d597248 (diff) | |
| download | bcm5719-llvm-7e7a5a050ab4f424a2a5832567f3ee2093aa0926.tar.gz bcm5719-llvm-7e7a5a050ab4f424a2a5832567f3ee2093aa0926.zip | |
Use all_of instead of a raw loop; NFC
Added some tests despite being NFC, since it looks like nothing was
exercising the "all incoming values to exit PHIs are same" logic.
llvm-svn: 268407
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopDeletion.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp index f888ad9e4f9..2e07f343681 100644 --- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp @@ -86,12 +86,10 @@ bool LoopDeletion::isLoopDead(Loop *L, ScalarEvolution &SE, // block. If there are different incoming values for different exiting // blocks, then it is impossible to statically determine which value should // be used. - for (unsigned i = 1, e = exitingBlocks.size(); i < e; ++i) { - if (incoming != P->getIncomingValueForBlock(exitingBlocks[i])) { - AllOutgoingValuesSame = false; - break; - } - } + AllOutgoingValuesSame = + all_of(makeArrayRef(exitingBlocks).slice(1), [&](BasicBlock *BB) { + return incoming == P->getIncomingValueForBlock(BB); + }); if (!AllOutgoingValuesSame) break; |

