diff options
Diffstat (limited to 'llvm/utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/AsmWriterEmitter.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 6c8ebfb5d21..6ebb3efe672 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -169,16 +169,14 @@ FindUniqueOperandCommands(std::vector<std::string> &UniqueOperandCommands, // Check to see if we already have 'Command' in UniqueOperandCommands. // If not, add it. - bool FoundIt = false; - for (unsigned idx = 0, e = UniqueOperandCommands.size(); idx != e; ++idx) - if (UniqueOperandCommands[idx] == Command) { - InstIdxs[i] = idx; - InstrsForCase[idx] += ", "; - InstrsForCase[idx] += Inst->CGI->TheDef->getName(); - FoundIt = true; - break; - } - if (!FoundIt) { + auto I = std::find(UniqueOperandCommands.begin(), + UniqueOperandCommands.end(), Command); + if (I != UniqueOperandCommands.end()) { + size_t idx = I - UniqueOperandCommands.begin(); + InstIdxs[i] = idx; + InstrsForCase[idx] += ", "; + InstrsForCase[idx] += Inst->CGI->TheDef->getName(); + } else { InstIdxs[i] = UniqueOperandCommands.size(); UniqueOperandCommands.push_back(std::move(Command)); InstrsForCase.push_back(Inst->CGI->TheDef->getName()); |