From 7946cc404f435a7b609d4bb00c8378e8c783475a Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 16 Apr 2021 20:47:38 +0200 Subject: [PATCH] [tblgen] Fold loop into assert to avoid unused variable warnings. NFCI. --- llvm/utils/TableGen/CodeGenDAGPatterns.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp index fe14611..30eadbd 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp @@ -2023,10 +2023,13 @@ void TreePatternNode::InlinePatternFragments( 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. -- 2.7.4