Use all_of to simplify control flow. NFC.
[oota-llvm.git] / lib / Analysis / CodeMetrics.cpp
index 90fddc539dcb76da08ac817450ec22a4a3bf2fde..4090b4cd752b64113ba10d6ee32f28744d07517c 100644 (file)
@@ -45,14 +45,8 @@ static void completeEphemeralValues(SmallVector<const Value *, 16> &WorkSet,
       continue;
 
     // If all uses of this value are ephemeral, then so is this value.
-    bool FoundNEUse = false;
-    for (const User *I : V->users())
-      if (!EphValues.count(I)) {
-        FoundNEUse = true;
-        break;
-      }
-
-    if (FoundNEUse)
+    if (!std::all_of(V->user_begin(), V->user_end(),
+                     [&](const User *U) { return EphValues.count(U); }))
       continue;
 
     EphValues.insert(V);