[llvm] d929351 - [TableGen] Use llvm::unique (NFC) (#94163)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 2 11:52:16 PDT 2024
Author: Kazu Hirata
Date: 2024-06-02T11:52:12-07:00
New Revision: d9293519bce5d2a6a22b73933810306317b51b3b
URL: https://github.com/llvm/llvm-project/commit/d9293519bce5d2a6a22b73933810306317b51b3b
DIFF: https://github.com/llvm/llvm-project/commit/d9293519bce5d2a6a22b73933810306317b51b3b.diff
LOG: [TableGen] Use llvm::unique (NFC) (#94163)
Added:
Modified:
llvm/utils/TableGen/AsmMatcherEmitter.cpp
llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
llvm/utils/TableGen/Common/CodeGenRegisters.cpp
llvm/utils/TableGen/Common/CodeGenSchedule.cpp
llvm/utils/TableGen/Common/CodeGenTarget.cpp
llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp
llvm/utils/TableGen/DFAEmitter.cpp
llvm/utils/TableGen/FastISelEmitter.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp
llvm/utils/TableGen/InstrInfoEmitter.cpp
llvm/utils/TableGen/RegisterInfoEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 8e475f9153b0d..29f15f0e57333 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -3472,9 +3472,7 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
}
return false;
});
- FeatureBitsets.erase(
- std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
- FeatureBitsets.end());
+ FeatureBitsets.erase(llvm::unique(FeatureBitsets), FeatureBitsets.end());
OS << "// Feature bitsets.\n"
<< "enum : " << getMinimalTypeForRange(FeatureBitsets.size()) << " {\n"
<< " AMFBS_None,\n";
diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
index 709aa00ae8b32..a8cecca0d4a54 100644
--- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp
@@ -1499,8 +1499,7 @@ void PatternToMatch::getPredicateRecords(
// Sort so that
diff erent orders get canonicalized to the same string.
llvm::sort(PredicateRecs, LessRecord());
// Remove duplicate predicates.
- PredicateRecs.erase(std::unique(PredicateRecs.begin(), PredicateRecs.end()),
- PredicateRecs.end());
+ PredicateRecs.erase(llvm::unique(PredicateRecs), PredicateRecs.end());
}
/// getPredicateCheck - Return a single string containing all of this
diff --git a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
index 624e8d5d54ba8..3c868b1e8f4fe 100644
--- a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
@@ -743,7 +743,7 @@ struct TupleExpander : SetTheory::Expander {
static void sortAndUniqueRegisters(CodeGenRegister::Vec &M) {
llvm::sort(M, deref<std::less<>>());
- M.erase(std::unique(M.begin(), M.end(), deref<std::equal_to<>>()), M.end());
+ M.erase(llvm::unique(M, deref<std::equal_to<>>()), M.end());
}
CodeGenRegisterClass::CodeGenRegisterClass(CodeGenRegBank &RegBank, Record *R)
diff --git a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
index 2ec0812320d14..152e68797b991 100644
--- a/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenSchedule.cpp
@@ -1699,7 +1699,7 @@ static void inferFromTransitions(ArrayRef<PredTransition> LastTransitions,
RecVec Preds;
transform(LastTransition.PredTerm, std::back_inserter(Preds),
[](const PredCheck &P) { return P.Predicate; });
- Preds.erase(std::unique(Preds.begin(), Preds.end()), Preds.end());
+ Preds.erase(llvm::unique(Preds), Preds.end());
dumpTransition(SchedModels, FromSC, SCTrans, Preds);
SCTrans.PredTerm = std::move(Preds);
SchedModels.getSchedClass(FromClassIdx)
diff --git a/llvm/utils/TableGen/Common/CodeGenTarget.cpp b/llvm/utils/TableGen/Common/CodeGenTarget.cpp
index bc3ccd888cb47..6915ecbbf3682 100644
--- a/llvm/utils/TableGen/Common/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenTarget.cpp
@@ -250,7 +250,7 @@ std::vector<ValueTypeByHwMode> CodeGenTarget::getRegisterVTs(Record *R) const {
// Remove duplicates.
llvm::sort(Result);
- Result.erase(std::unique(Result.begin(), Result.end()), Result.end());
+ Result.erase(llvm::unique(Result), Result.end());
return Result;
}
@@ -260,9 +260,7 @@ void CodeGenTarget::ReadLegalValueTypes() const {
// Remove duplicates.
llvm::sort(LegalValueTypes);
- LegalValueTypes.erase(
- std::unique(LegalValueTypes.begin(), LegalValueTypes.end()),
- LegalValueTypes.end());
+ LegalValueTypes.erase(llvm::unique(LegalValueTypes), LegalValueTypes.end());
}
CodeGenSchedModels &CodeGenTarget::getSchedModels() const {
diff --git a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp
index 331da97a6f7c6..6edbfa350e350 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp
+++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTableExecutorEmitter.cpp
@@ -70,9 +70,7 @@ void GlobalISelMatchTableExecutorEmitter::emitSubtargetFeatureBitsetImpl(
return (A.second < B.second);
});
- FeatureBitsets.erase(
- std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
- FeatureBitsets.end());
+ FeatureBitsets.erase(llvm::unique(FeatureBitsets), FeatureBitsets.end());
OS << "// Feature bitsets.\n"
<< "enum {\n"
<< " GIFBS_Invalid,\n";
diff --git a/llvm/utils/TableGen/DFAEmitter.cpp b/llvm/utils/TableGen/DFAEmitter.cpp
index 567184d3d5ee7..4b9affb6e850d 100644
--- a/llvm/utils/TableGen/DFAEmitter.cpp
+++ b/llvm/utils/TableGen/DFAEmitter.cpp
@@ -76,10 +76,9 @@ void DfaEmitter::visitDfaState(const DfaState &DS) {
continue;
// Sort and unique.
sort(NewStates);
- NewStates.erase(std::unique(NewStates.begin(), NewStates.end()),
- NewStates.end());
+ NewStates.erase(llvm::unique(NewStates), NewStates.end());
sort(TI);
- TI.erase(std::unique(TI.begin(), TI.end()), TI.end());
+ TI.erase(llvm::unique(TI), TI.end());
unsigned ToId = DfaStates.insert(NewStates);
DfaTransitions.emplace(std::pair(FromId, A), std::pair(ToId, TI));
}
diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp
index acfdc20316b72..8766d76683d0a 100644
--- a/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -821,8 +821,7 @@ void FastISelMap::printFunctionDefinitions(raw_ostream &OS) {
if (MI != SignaturesWithConstantForms.end()) {
// Unique any duplicates out of the list.
llvm::sort(MI->second);
- MI->second.erase(std::unique(MI->second.begin(), MI->second.end()),
- MI->second.end());
+ MI->second.erase(llvm::unique(MI->second), MI->second.end());
// Check each in order it was seen. It would be nice to have a good
// relative ordering between them, but we're not going for optimality
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index ec41cd9fec072..c29cb4edec181 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -2469,9 +2469,8 @@ void GlobalISelEmitter::run(raw_ostream &OS) {
// Sort and remove duplicates to get a list of unique renderer functions, in
// case some were mentioned more than once.
llvm::sort(CustomRendererFns);
- CustomRendererFns.erase(
- std::unique(CustomRendererFns.begin(), CustomRendererFns.end()),
- CustomRendererFns.end());
+ CustomRendererFns.erase(llvm::unique(CustomRendererFns),
+ CustomRendererFns.end());
// Create a table containing the LLT objects needed by the matcher and an enum
// for the matcher to reference them with.
diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp
index b3a05e081f637..ac85de189e116 100644
--- a/llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -776,9 +776,7 @@ void InstrInfoEmitter::emitFeatureVerifier(raw_ostream &OS,
}
return false;
});
- FeatureBitsets.erase(
- std::unique(FeatureBitsets.begin(), FeatureBitsets.end()),
- FeatureBitsets.end());
+ FeatureBitsets.erase(llvm::unique(FeatureBitsets), FeatureBitsets.end());
OS << "inline FeatureBitset computeRequiredFeatures(unsigned Opcode) {\n"
<< " enum : " << getMinimalTypeForRange(FeatureBitsets.size()) << " {\n"
<< " CEFBS_None,\n";
diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index 980d9a39636ea..2233072718bb2 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -370,11 +370,10 @@ static void finalizeDwarfRegNumsKeys(DwarfRegNumsVecTy &DwarfRegNums) {
"specified multiple times");
LastSeenReg = Reg;
}
- auto Last = std::unique(
- DwarfRegNums.begin(), DwarfRegNums.end(),
- [](const DwarfRegNumsMapPair &A, const DwarfRegNumsMapPair &B) {
- return A.first->getName() == B.first->getName();
- });
+ auto Last = llvm::unique(DwarfRegNums, [](const DwarfRegNumsMapPair &A,
+ const DwarfRegNumsMapPair &B) {
+ return A.first->getName() == B.first->getName();
+ });
DwarfRegNums.erase(Last, DwarfRegNums.end());
}
More information about the llvm-commits
mailing list