-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[TableGen] Use llvm::unique (NFC) #94163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_llvm_unique_llvm_TableGen
Jun 2, 2024
Merged
[TableGen] Use llvm::unique (NFC) #94163
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_llvm_unique_llvm_TableGen
Jun 2, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-llvm-globalisel Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/94163.diff 11 Files Affected:
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 different 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());
}
|
kuhar
approved these changes
Jun 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.