Skip to content

Commit 7946cc4

Browse files
committed
[tblgen] Fold loop into assert to avoid unused variable warnings. NFCI.
1 parent ff55d01 commit 7946cc4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,10 +2023,13 @@ void TreePatternNode::InlinePatternFragments(
20232023
if (ChildAlternatives[i].empty())
20242024
return;
20252025

2026-
for (const auto &NewChild : ChildAlternatives[i])
2027-
assert((Child->getPredicateCalls().empty() ||
2028-
NewChild->getPredicateCalls() == Child->getPredicateCalls()) &&
2029-
"Non-empty child predicate clobbered!");
2026+
assert(Child->getPredicateCalls().empty() ||
2027+
llvm::all_of(ChildAlternatives[i],
2028+
[&](const TreePatternNodePtr &NewChild) {
2029+
return NewChild->getPredicateCalls() ==
2030+
Child->getPredicateCalls();
2031+
}) &&
2032+
"Non-empty child predicate clobbered!");
20302033
}
20312034

20322035
// The end result is an all-pairs construction of the resultant pattern.

0 commit comments

Comments
 (0)