[tblgen] Fold loop into assert to avoid unused variable warnings. NFCI.

GitOrigin-RevId: 7946cc404f435a7b609d4bb00c8378e8c783475a
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp
index fe14611..30eadbd 100644
--- a/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -2023,10 +2023,13 @@
       if (ChildAlternatives[i].empty())
         return;
 
-      for (const auto &NewChild : ChildAlternatives[i])
-        assert((Child->getPredicateCalls().empty() ||
-                NewChild->getPredicateCalls() == Child->getPredicateCalls()) &&
-               "Non-empty child predicate clobbered!");
+      assert(Child->getPredicateCalls().empty() ||
+             llvm::all_of(ChildAlternatives[i],
+                          [&](const TreePatternNodePtr &NewChild) {
+                            return NewChild->getPredicateCalls() ==
+                                   Child->getPredicateCalls();
+                          }) &&
+                 "Non-empty child predicate clobbered!");
     }
 
     // The end result is an all-pairs construction of the resultant pattern.