From: Owen Anderson Date: Sat, 24 Dec 2022 05:03:23 +0000 (-0700) Subject: [NFC] Elminate some needless nested-map complexity. X-Git-Tag: upstream/17.0.6~22636 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f34847e112acfa6370f613034e0459af06f522bb;p=platform%2Fupstream%2Fllvm.git [NFC] Elminate some needless nested-map complexity. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D140648 --- diff --git a/llvm/utils/TableGen/FastISelEmitter.cpp b/llvm/utils/TableGen/FastISelEmitter.cpp index 31a588a..0a88f67 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 PredCheckMap; - typedef std::map RetPredCheckMap; - typedef std::map TypeRetPredCheckMap; - typedef std::map OpcodeTypeRetPredCheckMap; - typedef std::map - OperandsOpcodeTypeRetPredCheckMap; - - OperandsOpcodeTypeRetPredCheckMap SimplePatternsCheck; + std::set> + SimplePatternsCheck; std::map > 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));