From: Chandler Carruth Date: Fri, 13 Feb 2015 04:18:14 +0000 (+0000) Subject: [unroll] Replace a boolean, for loop, condition, and break with X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=361ac0df6570558bd80b21e257a0a3e465cd20b4;p=oota-llvm.git [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 --- diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index 4c57c922bc9..ccc4a248476 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/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(U))) { - AllUsersFolded = false; - break; - } - if (AllUsersFolded) { + if (std::all_of(I->user_begin(), I->user_end(), [&](User *U) { + return DeadInstructions.count(cast(U)); + })) { NumberOfOptimizedInstructions += TTI.getUserCost(I); DeadInstructions.insert(I); EnqueueOperands(*I);