Skip to content

Commit 5fa989b

Browse files
[Analysis] Avoid repeated hash lookups (NFC) (#123159)
1 parent 286f842 commit 5fa989b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Analysis/InstructionPrecedenceTracking.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ void InstructionPrecedenceTracking::insertInstructionTo(const Instruction *Inst,
115115
void InstructionPrecedenceTracking::removeInstruction(const Instruction *Inst) {
116116
auto *BB = Inst->getParent();
117117
assert(BB && "must be called before instruction is actually removed");
118-
if (FirstSpecialInsts.count(BB) && FirstSpecialInsts[BB] == Inst)
119-
FirstSpecialInsts.erase(BB);
118+
auto It = FirstSpecialInsts.find(BB);
119+
if (It != FirstSpecialInsts.end() && It->second == Inst)
120+
FirstSpecialInsts.erase(It);
120121
}
121122

122123
void InstructionPrecedenceTracking::removeUsersOf(const Instruction *Inst) {

0 commit comments

Comments
 (0)