Skip to content

Commit 1c5b848

Browse files
[Tablegen] Use llvm::find_if (NFC)
1 parent b7c5e0b commit 1c5b848

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3701,10 +3701,11 @@ void CodeGenDAGPatterns::parseInstructionPattern(
37013701
for (unsigned i = 0; i != NumResults; ++i) {
37023702
if (i == CGI.Operands.size()) {
37033703
const std::string &OpName =
3704-
std::find_if(InstResults.begin(), InstResults.end(),
3705-
[](const std::pair<std::string, TreePatternNodePtr> &P) {
3706-
return P.second;
3707-
})
3704+
llvm::find_if(
3705+
InstResults,
3706+
[](const std::pair<std::string, TreePatternNodePtr> &P) {
3707+
return P.second;
3708+
})
37083709
->first;
37093710

37103711
I.error("'" + OpName + "' set but does not appear in operand list!");

llvm/utils/TableGen/DirectiveEmitter.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,8 @@ void GenerateGetKind(const std::vector<Record *> &Records, raw_ostream &OS,
273273
StringRef Enum, const DirectiveLanguage &DirLang,
274274
StringRef Prefix, bool ImplicitAsUnknown) {
275275

276-
auto DefaultIt = std::find_if(Records.begin(), Records.end(), [](Record *R) {
277-
return R->getValueAsBit("isDefault") == true;
278-
});
276+
auto DefaultIt = llvm::find_if(
277+
Records, [](Record *R) { return R->getValueAsBit("isDefault") == true; });
279278

280279
if (DefaultIt == Records.end()) {
281280
PrintError("At least one " + Enum + " must be defined as default.");
@@ -312,10 +311,9 @@ void GenerateGetKindClauseVal(const DirectiveLanguage &DirLang,
312311
if (ClauseVals.size() <= 0)
313312
continue;
314313

315-
auto DefaultIt =
316-
std::find_if(ClauseVals.begin(), ClauseVals.end(), [](Record *CV) {
317-
return CV->getValueAsBit("isDefault") == true;
318-
});
314+
auto DefaultIt = llvm::find_if(ClauseVals, [](Record *CV) {
315+
return CV->getValueAsBit("isDefault") == true;
316+
});
319317

320318
if (DefaultIt == ClauseVals.end()) {
321319
PrintError("At least one val in Clause " + C.getFormattedName() +

llvm/utils/TableGen/GlobalISel/GIMatchTree.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,10 @@ void GIMatchTreeBuilder::runStep() {
266266
LLVM_DEBUG(dbgs() << "Leaf contains multiple rules, drop after the first "
267267
"fully tested rule\n");
268268
auto FirstFullyTested =
269-
std::find_if(Leaves.begin(), Leaves.end(),
270-
[](const GIMatchTreeBuilderLeafInfo &X) {
271-
return X.isFullyTraversed() && X.isFullyTested() &&
272-
!X.getMatchDag().hasPostMatchPredicate();
273-
});
269+
llvm::find_if(Leaves, [](const GIMatchTreeBuilderLeafInfo &X) {
270+
return X.isFullyTraversed() && X.isFullyTested() &&
271+
!X.getMatchDag().hasPostMatchPredicate();
272+
});
274273
if (FirstFullyTested != Leaves.end())
275274
FirstFullyTested++;
276275

llvm/utils/TableGen/GlobalISelEmitter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2249,10 +2249,10 @@ class InstructionMatcher final : public PredicateListMatcher<PredicateMatcher> {
22492249
}
22502250

22512251
OperandMatcher &getOperand(unsigned OpIdx) {
2252-
auto I = std::find_if(Operands.begin(), Operands.end(),
2253-
[&OpIdx](const std::unique_ptr<OperandMatcher> &X) {
2254-
return X->getOpIdx() == OpIdx;
2255-
});
2252+
auto I = llvm::find_if(Operands,
2253+
[&OpIdx](const std::unique_ptr<OperandMatcher> &X) {
2254+
return X->getOpIdx() == OpIdx;
2255+
});
22562256
if (I != Operands.end())
22572257
return **I;
22582258
llvm_unreachable("Failed to lookup operand");

0 commit comments

Comments
 (0)