Skip to content

Commit d929351

Browse files
[TableGen] Use llvm::unique (NFC) (#94163)
1 parent c26a993 commit d929351

11 files changed

+17
-30
lines changed

llvm/utils/TableGen/AsmMatcherEmitter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,9 +3472,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
34723472
}
34733473
return false;
34743474
});
3475-
FeatureBitsets.erase(
3476-
std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
3477-
FeatureBitsets.end());
3475+
FeatureBitsets.erase(llvm::unique(FeatureBitsets), FeatureBitsets.end());
34783476
OS << "// Feature bitsets.\n"
34793477
<< "enum : " << getMinimalTypeForRange(FeatureBitsets.size()) << " {\n"
34803478
<< " AMFBS_None,\n";

llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,8 +1499,7 @@ void PatternToMatch::getPredicateRecords(
14991499
// Sort so that different orders get canonicalized to the same string.
15001500
llvm::sort(PredicateRecs, LessRecord());
15011501
// Remove duplicate predicates.
1502-
PredicateRecs.erase(std::unique(PredicateRecs.begin(), PredicateRecs.end()),
1503-
PredicateRecs.end());
1502+
PredicateRecs.erase(llvm::unique(PredicateRecs), PredicateRecs.end());
15041503
}
15051504

15061505
/// getPredicateCheck - Return a single string containing all of this

llvm/utils/TableGen/Common/CodeGenRegisters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ struct TupleExpander : SetTheory::Expander {
743743

744744
static void sortAndUniqueRegisters(CodeGenRegister::Vec &M) {
745745
llvm::sort(M, deref<std::less<>>());
746-
M.erase(std::unique(M.begin(), M.end(), deref<std::equal_to<>>()), M.end());
746+
M.erase(llvm::unique(M, deref<std::equal_to<>>()), M.end());
747747
}
748748

749749
CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R)

llvm/utils/TableGen/Common/CodeGenSchedule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ static void inferFromTransitions(ArrayRef<PredTransition> LastTransitions,
16991699
RecVec Preds;
17001700
transform(LastTransition.PredTerm, std::back_inserter(Preds),
17011701
[](const PredCheck &P) { return P.Predicate; });
1702-
Preds.erase(std::unique(Preds.begin(), Preds.end()), Preds.end());
1702+
Preds.erase(llvm::unique(Preds), Preds.end());
17031703
dumpTransition(SchedModels, FromSC, SCTrans, Preds);
17041704
SCTrans.PredTerm = std::move(Preds);
17051705
SchedModels.getSchedClass(FromClassIdx)

llvm/utils/TableGen/Common/CodeGenTarget.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ std::vector<ValueTypeByHwMode> CodeGenTarget::getRegisterVTs(Record *R) const {
250250

251251
// Remove duplicates.
252252
llvm::sort(Result);
253-
Result.erase(std::unique(Result.begin(), Result.end()), Result.end());
253+
Result.erase(llvm::unique(Result), Result.end());
254254
return Result;
255255
}
256256

@@ -260,9 +260,7 @@ void CodeGenTarget::ReadLegalValueTypes() const {
260260

261261
// Remove duplicates.
262262
llvm::sort(LegalValueTypes);
263-
LegalValueTypes.erase(
264-
std::unique(LegalValueTypes.begin(), LegalValueTypes.end()),
265-
LegalValueTypes.end());
263+
LegalValueTypes.erase(llvm::unique(LegalValueTypes), LegalValueTypes.end());
266264
}
267265

268266
CodeGenSchedModels &CodeGenTarget::getSchedModels() const {

llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ void GlobalISelMatchTableExecutorEmitter::emitSubtargetFeatureBitsetImpl(
7070

7171
return (A.second < B.second);
7272
});
73-
FeatureBitsets.erase(
74-
std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
75-
FeatureBitsets.end());
73+
FeatureBitsets.erase(llvm::unique(FeatureBitsets), FeatureBitsets.end());
7674
OS << "// Feature bitsets.\n"
7775
<< "enum {\n"
7876
<< " GIFBS_Invalid,\n";

llvm/utils/TableGen/DFAEmitter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,9 @@ void DfaEmitter::visitDfaState(const DfaState &DS) {
7676
continue;
7777
// Sort and unique.
7878
sort(NewStates);
79-
NewStates.erase(std::unique(NewStates.begin(), NewStates.end()),
80-
NewStates.end());
79+
NewStates.erase(llvm::unique(NewStates), NewStates.end());
8180
sort(TI);
82-
TI.erase(std::unique(TI.begin(), TI.end()), TI.end());
81+
TI.erase(llvm::unique(TI), TI.end());
8382
unsigned ToId = DfaStates.insert(NewStates);
8483
DfaTransitions.emplace(std::pair(FromId, A), std::pair(ToId, TI));
8584
}

llvm/utils/TableGen/FastISelEmitter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,7 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) {
821821
if (MI != SignaturesWithConstantForms.end()) {
822822
// Unique any duplicates out of the list.
823823
llvm::sort(MI->second);
824-
MI->second.erase(std::unique(MI->second.begin(), MI->second.end()),
825-
MI->second.end());
824+
MI->second.erase(llvm::unique(MI->second), MI->second.end());
826825

827826
// Check each in order it was seen. It would be nice to have a good
828827
// relative ordering between them, but we're not going for optimality

llvm/utils/TableGen/GlobalISelEmitter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,9 +2469,8 @@ void GlobalISelEmitter::run(raw_ostream &OS) {
24692469
// Sort and remove duplicates to get a list of unique renderer functions, in
24702470
// case some were mentioned more than once.
24712471
llvm::sort(CustomRendererFns);
2472-
CustomRendererFns.erase(
2473-
std::unique(CustomRendererFns.begin(), CustomRendererFns.end()),
2474-
CustomRendererFns.end());
2472+
CustomRendererFns.erase(llvm::unique(CustomRendererFns),
2473+
CustomRendererFns.end());
24752474

24762475
// Create a table containing the LLT objects needed by the matcher and an enum
24772476
// for the matcher to reference them with.

llvm/utils/TableGen/InstrInfoEmitter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,7 @@ void InstrInfoEmitter::emitFeatureVerifier(raw_ostream &OS,
776776
}
777777
return false;
778778
});
779-
FeatureBitsets.erase(
780-
std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
781-
FeatureBitsets.end());
779+
FeatureBitsets.erase(llvm::unique(FeatureBitsets), FeatureBitsets.end());
782780
OS << "inline FeatureBitset computeRequiredFeatures(unsigned Opcode) {\n"
783781
<< " enum : " << getMinimalTypeForRange(FeatureBitsets.size()) << " {\n"
784782
<< " CEFBS_None,\n";

llvm/utils/TableGen/RegisterInfoEmitter.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,10 @@ static void finalizeDwarfRegNumsKeys(DwarfRegNumsVecTy &DwarfRegNums) {
370370
"specified multiple times");
371371
LastSeenReg = Reg;
372372
}
373-
auto Last = std::unique(
374-
DwarfRegNums.begin(), DwarfRegNums.end(),
375-
[](const DwarfRegNumsMapPair &A, const DwarfRegNumsMapPair &B) {
376-
return A.first->getName() == B.first->getName();
377-
});
373+
auto Last = llvm::unique(DwarfRegNums, [](const DwarfRegNumsMapPair &A,
374+
const DwarfRegNumsMapPair &B) {
375+
return A.first->getName() == B.first->getName();
376+
});
378377
DwarfRegNums.erase(Last, DwarfRegNums.end());
379378
}
380379

0 commit comments

Comments
 (0)