mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: support calling SILModule::willDeleteInstruction twice for the same instruction.
This happens in AddressLowering.
This commit is contained in:
@@ -264,9 +264,11 @@ void SILModule::willDeleteInstruction(SILInstruction *I) {
|
||||
if (const CanOpenedArchetypeType archeTy =
|
||||
svi->getDefinedOpenedArchetype()) {
|
||||
OpenedArchetypeKey key = {archeTy, svi->getFunction()};
|
||||
assert(RootOpenedArchetypeDefs.lookup(key) == svi &&
|
||||
"archetype def was not registered");
|
||||
RootOpenedArchetypeDefs.erase(key);
|
||||
// In case `willDeleteInstruction` is called twice for the same instruction,
|
||||
// we need to check if the archetype is really still in the map for this
|
||||
// instruction.
|
||||
if (RootOpenedArchetypeDefs.lookup(key) == svi)
|
||||
RootOpenedArchetypeDefs.erase(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user