[llvm] r229058 - [unroll] Replace a boolean, for loop, condition, and break with
Chandler Carruth
chandlerc at gmail.com
Thu Feb 12 20:18:14 PST 2015
Author: chandlerc
Date: Thu Feb 12 22:18:14 2015
New Revision: 229058
URL: http://llvm.org/viewvc/llvm-project?rev=229058&view=rev
Log:
[unroll] Replace a boolean, for loop, condition, and break with
std::all_of and a lambda. Much cleaner, no functionality
changed.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp?rev=229058&r1=229057&r2=229058&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp Thu Feb 12 22:18:14 2015
@@ -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);
More information about the llvm-commits
mailing list