mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix a bug related to the opened archetypes tracking
If a SILBuilder creates a new instruction based on an old instruction and a new instruction is supposed to use some opened archetypes, one needs to set a proper opened archetypes context in the builder based on the opened archetypes used by the old instruction. This fixes rdar://28024272
This commit is contained in:
@@ -135,6 +135,11 @@ public:
|
||||
void setInsertionPoint(SILBasicBlock *BB, SILBasicBlock::iterator InsertPt) {
|
||||
this->BB = BB;
|
||||
this->InsertPt = InsertPt;
|
||||
if (InsertPt == BB->end())
|
||||
return;
|
||||
// Set the opened archetype context from the instruction.
|
||||
this->getOpenedArchetypes().addOpenedArchetypeOperands(
|
||||
InsertPt->getTypeDependentOperands());
|
||||
}
|
||||
|
||||
/// setInsertionPoint - Set the insertion point to insert before the specified
|
||||
@@ -177,6 +182,14 @@ public:
|
||||
return InsertedInstrs;
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Opened archetypes handling
|
||||
//===--------------------------------------------------------------------===//
|
||||
void addOpenedArchetypeOperands(SILInstruction *I) {
|
||||
getOpenedArchetypes().addOpenedArchetypeOperands(
|
||||
I->getTypeDependentOperands());
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Type remapping
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user