[llvm] f34847e - [NFC] Elminate some needless nested-map complexity.
Owen Anderson via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 25 18:36:31 PST 2022
Author: Owen Anderson
Date: 2022-12-25T19:36:27-07:00
New Revision: f34847e112acfa6370f613034e0459af06f522bb
URL: https://github.com/llvm/llvm-project/commit/f34847e112acfa6370f613034e0459af06f522bb
DIFF: https://github.com/llvm/llvm-project/commit/f34847e112acfa6370f613034e0459af06f522bb.diff
LOG: [NFC] Elminate some needless nested-map complexity.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D140648
Added:
Modified:
llvm/utils/TableGen/FastISelEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp
index 31a588a266d1f..0a88f67be168a 100644
--- a/llvm/utils/TableGen/FastISelEmitter.cpp
+++ b/llvm/utils/TableGen/FastISelEmitter.cpp
@@ -381,14 +381,9 @@ class FastISelMap {
OperandsOpcodeTypeRetPredMap SimplePatterns;
// This is used to check that there are no duplicate predicates
- typedef std::multimap<std::string, bool> PredCheckMap;
- typedef std::map<MVT::SimpleValueType, PredCheckMap> RetPredCheckMap;
- typedef std::map<MVT::SimpleValueType, RetPredCheckMap> TypeRetPredCheckMap;
- typedef std::map<std::string, TypeRetPredCheckMap> OpcodeTypeRetPredCheckMap;
- typedef std::map<OperandsSignature, OpcodeTypeRetPredCheckMap>
- OperandsOpcodeTypeRetPredCheckMap;
-
- OperandsOpcodeTypeRetPredCheckMap SimplePatternsCheck;
+ std::set<std::tuple<OperandsSignature, std::string, MVT::SimpleValueType,
+ MVT::SimpleValueType, std::string>>
+ SimplePatternsCheck;
std::map<OperandsSignature, std::vector<OperandsSignature> >
SignaturesWithConstantForms;
@@ -587,16 +582,15 @@ void FastISelMap::collectPatterns(CodeGenDAGPatterns &CGP) {
int complexity = Pattern.getPatternComplexity(CGP);
- if (SimplePatternsCheck[Operands][OpcodeName][VT]
- [RetVT].count(PredicateCheck)) {
+ auto inserted_simple_pattern = SimplePatternsCheck.insert(
+ std::make_tuple(Operands, OpcodeName, VT, RetVT, PredicateCheck));
+ if (!inserted_simple_pattern.second) {
PrintFatalError(Pattern.getSrcRecord()->getLoc(),
"Duplicate predicate in FastISel table!");
}
- SimplePatternsCheck[Operands][OpcodeName][VT][RetVT].insert(
- std::make_pair(PredicateCheck, true));
- // Note: Instructions with the same complexity will appear in the order
- // that they are encountered.
+ // Note: Instructions with the same complexity will appear in the order
+ // that they are encountered.
SimplePatterns[Operands][OpcodeName][VT][RetVT].emplace(complexity,
std::move(Memo));
More information about the llvm-commits
mailing list