[unroll] Replace a boolean, for loop, condition, and break with

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
This commit is contained in:
Chandler Carruth 2015-02-13 04:18:14 +00:00
parent 758256535c
commit 361ac0df65

View File

@ -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);