Skip to content

Commit cfc385d

Browse files
committed
X86FoldTablesEmitter - fix static analyzer potential invalid iterator warning. NFCI.
1 parent 37cdac6 commit cfc385d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/utils/TableGen/X86FoldTablesEmitter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,14 +618,14 @@ void X86FoldTablesEmitter::run(formatted_raw_ostream &OS) {
618618
uint8_t Opc =
619619
getValueFromBitsInit(MemInst->TheDef->getValueAsBitsInit("Opcode"));
620620

621-
if (RegInsts.count(Opc) == 0)
621+
auto RegInstsIt = RegInsts.find(Opc);
622+
if (RegInstsIt == RegInsts.end())
622623
continue;
623624

624625
// Two forms (memory & register) of the same instruction must have the same
625626
// opcode. try matching only with register form instructions with the same
626627
// opcode.
627-
std::vector<const CodeGenInstruction *> &OpcRegInsts =
628-
RegInsts.find(Opc)->second;
628+
std::vector<const CodeGenInstruction *> &OpcRegInsts = RegInstsIt->second;
629629

630630
auto Match = find_if(OpcRegInsts, IsMatch(MemInst, Records));
631631
if (Match != OpcRegInsts.end()) {

0 commit comments

Comments
 (0)