SILModule: track opened archetypes per function.

In theory we could map opened archetypes per module because opened archetypes _should_ be unique across the module.
But currently in some rare cases SILGen re-uses the same opened archetype in multiple functions.
The fix is to add the SILFunction to the map's key.
That also requires that we update the map whenever instructions are moved from one function to another.

This fixes a compiler crash.

rdar://76916931
This commit is contained in:
Erik Eckstein
2021-04-23 14:13:26 +02:00
parent 619226b480
commit eecb9fa975
8 changed files with 118 additions and 28 deletions

View File

@@ -1020,19 +1020,12 @@ public:
/// Transfer all blocks of \p F into this function, at the begin of the block
/// list.
void moveAllBlocksFromOtherFunction(SILFunction *F) {
BlockList.splice(begin(), F->BlockList);
}
void moveAllBlocksFromOtherFunction(SILFunction *F);
/// Transfer \p blockInOtherFunction of another function into this function,
/// before \p insertPointInThisFunction.
void moveBlockFromOtherFunction(SILBasicBlock *blockInOtherFunction,
iterator insertPointInThisFunction) {
SILFunction *otherFunc = blockInOtherFunction->getParent();
assert(otherFunc != this);
BlockList.splice(insertPointInThisFunction, otherFunc->BlockList,
blockInOtherFunction);
}
iterator insertPointInThisFunction);
/// Move block \p BB to immediately before the iterator \p IP.
///