diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2015-02-13 04:18:14 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2015-02-13 04:18:14 +0000 |
| commit | 7824bc9241e6ff970016f45540dfe0751bcda48a (patch) | |
| tree | 830d47215399295a0f994403e3409eaafa3d6230 /llvm/lib/Transforms/Scalar | |
| parent | 06d537cdd68d8b3ece5862be1e0097b8113d390c (diff) | |
| download | bcm5719-llvm-7824bc9241e6ff970016f45540dfe0751bcda48a.tar.gz bcm5719-llvm-7824bc9241e6ff970016f45540dfe0751bcda48a.zip | |
[unroll] Replace a boolean, for loop, condition, and break with
std::all_of and a lambda. Much cleaner, no functionality
changed.
llvm-svn: 229058
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index 4c57c922bc9..ccc4a248476 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -542,14 +542,10 @@ public: continue; if (DeadInstructions.count(I)) continue; - bool AllUsersFolded = true; - for (User *U : I->users()) - if (!DeadInstructions.count(cast<Instruction>(U))) { - AllUsersFolded = false; - break; - } - if (AllUsersFolded) { + if (std::all_of(I->user_begin(), I->user_end(), [&](User *U) { + return DeadInstructions.count(cast<Instruction>(U)); + })) { NumberOfOptimizedInstructions += TTI.getUserCost(I); DeadInstructions.insert(I); EnqueueOperands(*I); |

