[IPT] Narrow scope of removeInstruction invalidation [NFC]

We only need to invalidate if the instruction being removed is the cached "first special instruction".  If the instruction is before that one, it can't (by assumption) be special.  If it is after that one, it wasn't the first.
This commit is contained in:
Philip Reames 2021-10-08 10:32:36 -07:00
parent b3024ac084
commit b4498e6b8d
1 changed files with 4 additions and 2 deletions

View File

@ -107,8 +107,10 @@ void InstructionPrecedenceTracking::insertInstructionTo(const Instruction *Inst,
}
void InstructionPrecedenceTracking::removeInstruction(const Instruction *Inst) {
if (isSpecialInstruction(Inst))
FirstSpecialInsts.erase(Inst->getParent());
auto *BB = Inst->getParent();
assert(BB && "must be called before instruction is actually removed");
if (FirstSpecialInsts.count(BB) && FirstSpecialInsts[BB] == Inst)
FirstSpecialInsts.erase(BB);
}
void InstructionPrecedenceTracking::removeUsersOf(const Instruction *Inst) {