std::all_of and a lambda. Much cleaner, no functionality
changed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229058
91177308-0d34-0410-b5e6-
96231b3b80d8
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);