[llvm] 7946cc4 - [tblgen] Fold loop into assert to avoid unused variable warnings. NFCI.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 16 11:50:24 PDT 2021
Author: Benjamin Kramer
Date: 2021-04-16T20:47:38+02:00
New Revision: 7946cc404f435a7b609d4bb00c8378e8c783475a
URL: https://github.com/llvm/llvm-project/commit/7946cc404f435a7b609d4bb00c8378e8c783475a
DIFF: https://github.com/llvm/llvm-project/commit/7946cc404f435a7b609d4bb00c8378e8c783475a.diff
LOG: [tblgen] Fold loop into assert to avoid unused variable warnings. NFCI.
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index fe14611d0c5a..30eadbd84bd8 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.
More information about the llvm-commits
mailing list