From cfc385d95445ea52ac68d55f2c13ac8d19f79855 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 6 Nov 2019 13:31:00 +0000 Subject: [PATCH] X86FoldTablesEmitter - fix static analyzer potential invalid iterator warning. NFCI. --- llvm/utils/TableGen/X86FoldTablesEmitter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/utils/TableGen/X86FoldTablesEmitter.cpp b/llvm/utils/TableGen/X86FoldTablesEmitter.cpp index 2c15e35..8026c32 100644 --- a/llvm/utils/TableGen/X86FoldTablesEmitter.cpp +++ b/llvm/utils/TableGen/X86FoldTablesEmitter.cpp @@ -618,14 +618,14 @@ void X86FoldTablesEmitter::run(formatted_raw_ostream &OS) { uint8_t Opc = getValueFromBitsInit(MemInst->TheDef->getValueAsBitsInit("Opcode")); - if (RegInsts.count(Opc) == 0) + auto RegInstsIt = RegInsts.find(Opc); + if (RegInstsIt == RegInsts.end()) continue; // Two forms (memory & register) of the same instruction must have the same // opcode. try matching only with register form instructions with the same // opcode. - std::vector &OpcRegInsts = - RegInsts.find(Opc)->second; + std::vector &OpcRegInsts = RegInstsIt->second; auto Match = find_if(OpcRegInsts, IsMatch(MemInst, Records)); if (Match != OpcRegInsts.end()) { -- 2.7.4