Index: utils/TableGen/RISCVCompressInstEmitter.cpp =================================================================== --- utils/TableGen/RISCVCompressInstEmitter.cpp +++ utils/TableGen/RISCVCompressInstEmitter.cpp @@ -474,7 +474,7 @@ SourceOperandMap, DestOperandMap)); } -static void getReqFeatures(std::map &FeaturesMap, +static void getReqFeatures(std::set &FeaturesSet, const std::vector &ReqFeatures) { for (auto &R : ReqFeatures) { StringRef AsmCondString = R->getValueAsString("AssemblerCondString"); @@ -483,11 +483,9 @@ SmallVector Ops; SplitString(AsmCondString, Ops, ","); assert(!Ops.empty() && "AssemblerCondString cannot be empty"); - for (auto &Op : Ops) { assert(!Op.empty() && "Empty operator"); - if (FeaturesMap.find(Op) == FeaturesMap.end()) - FeaturesMap[Op] = FeaturesMap.size(); + FeaturesSet.insert(Op); } } } @@ -620,9 +618,9 @@ CaseStream.indent(4) << "case " + Namespace + "::" + CurOp + ": {\n"; } - std::map FeaturesMap; + std::set FeaturesSet; // Add CompressPat required features. - getReqFeatures(FeaturesMap, CompressPat.PatReqFeatures); + getReqFeatures(FeaturesSet, CompressPat.PatReqFeatures); // Add Dest instruction required features. std::vector ReqFeatures; @@ -630,11 +628,10 @@ copy_if(RF, std::back_inserter(ReqFeatures), [](Record *R) { return R->getValueAsBit("AssemblerMatcherPredicate"); }); - getReqFeatures(FeaturesMap, ReqFeatures); + getReqFeatures(FeaturesSet, ReqFeatures); // Emit checks for all required features. - for (auto &F : FeaturesMap) { - StringRef Op = F.first; + for (auto &Op : FeaturesSet) { if (Op[0] == '!') CondStream.indent(6) << ("!STI.getFeatureBits()[" + Namespace + "::" + Op.substr(1) + "]")