@@ -1322,7 +1322,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
13221322 " Operand is of an ArchetypeType that does not exist in the "
13231323 " Caller's generic param list." );
13241324 if (auto OpenedA = getOpenedArchetypeOf (A)) {
1325- auto *openingInst = F->getModule ().getOpenedArchetypeInst (OpenedA);
1325+ auto *openingInst = F->getModule ().getOpenedArchetypeInst (OpenedA, F );
13261326 require (I == nullptr || openingInst == I ||
13271327 properlyDominates (openingInst, I),
13281328 " Use of an opened archetype should be dominated by a "
@@ -1456,7 +1456,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
14561456 FoundOpenedArchetypes.insert (A);
14571457 // Also check that they are properly tracked inside the current
14581458 // function.
1459- auto *openingInst = F.getModule ().getOpenedArchetypeInst (A);
1459+ auto *openingInst = F.getModule ().getOpenedArchetypeInst (A,
1460+ AI->getFunction ());
14601461 require (openingInst == AI ||
14611462 properlyDominates (openingInst, AI),
14621463 " Use of an opened archetype should be dominated by a "
@@ -3404,7 +3405,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
34043405 auto archetype = getOpenedArchetypeOf (OEI->getType ().getASTType ());
34053406 require (archetype,
34063407 " open_existential_addr result must be an opened existential archetype" );
3407- require (OEI->getModule ().getOpenedArchetypeInst (archetype) == OEI,
3408+ require (OEI->getModule ().getOpenedArchetypeInst (archetype,
3409+ OEI->getFunction ()) == OEI,
34083410 " Archetype opened by open_existential_addr should be registered in "
34093411 " SILFunction" );
34103412
@@ -3437,7 +3439,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
34373439 auto archetype = getOpenedArchetypeOf (resultInstanceTy);
34383440 require (archetype,
34393441 " open_existential_ref result must be an opened existential archetype" );
3440- require (OEI->getModule ().getOpenedArchetypeInst (archetype) == OEI,
3442+ require (OEI->getModule ().getOpenedArchetypeInst (archetype,
3443+ OEI->getFunction ()) == OEI,
34413444 " Archetype opened by open_existential_ref should be registered in "
34423445 " SILFunction" );
34433446 }
@@ -3459,7 +3462,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
34593462 auto archetype = getOpenedArchetypeOf (resultInstanceTy);
34603463 require (archetype,
34613464 " open_existential_box result must be an opened existential archetype" );
3462- require (OEI->getModule ().getOpenedArchetypeInst (archetype) == OEI,
3465+ require (OEI->getModule ().getOpenedArchetypeInst (archetype,
3466+ OEI->getFunction ()) == OEI,
34633467 " Archetype opened by open_existential_box should be registered in "
34643468 " SILFunction" );
34653469 }
@@ -3481,7 +3485,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
34813485 auto archetype = getOpenedArchetypeOf (resultInstanceTy);
34823486 require (archetype,
34833487 " open_existential_box_value result not an opened existential archetype" );
3484- require (OEI->getModule ().getOpenedArchetypeInst (archetype) == OEI,
3488+ require (OEI->getModule ().getOpenedArchetypeInst (archetype,
3489+ OEI->getFunction ()) == OEI,
34853490 " Archetype opened by open_existential_box_value should be "
34863491 " registered in SILFunction" );
34873492 }
@@ -3527,7 +3532,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
35273532 require (archetype, " open_existential_metatype result must be an opened "
35283533 " existential metatype" );
35293534 require (
3530- I->getModule ().getOpenedArchetypeInst (archetype) == I,
3535+ I->getModule ().getOpenedArchetypeInst (archetype, I-> getFunction () ) == I,
35313536 " Archetype opened by open_existential_metatype should be registered in "
35323537 " SILFunction" );
35333538 }
@@ -3546,7 +3551,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
35463551 auto archetype = getOpenedArchetypeOf (OEI->getType ().getASTType ());
35473552 require (archetype, " open_existential_value result must be an opened "
35483553 " existential archetype" );
3549- require (OEI->getModule ().getOpenedArchetypeInst (archetype) == OEI,
3554+ require (OEI->getModule ().getOpenedArchetypeInst (archetype,
3555+ OEI->getFunction ()) == OEI,
35503556 " Archetype opened by open_existential should be registered in "
35513557 " SILFunction" );
35523558 }
@@ -3834,7 +3840,7 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
38343840 SILValue Def;
38353841 if (t->isOpenedExistential ()) {
38363842 auto archetypeTy = cast<ArchetypeType>(t);
3837- Def = I->getModule ().getOpenedArchetypeInst (archetypeTy);
3843+ Def = I->getModule ().getOpenedArchetypeInst (archetypeTy, I-> getFunction () );
38383844 require (Def, " Opened archetype should be registered in SILModule" );
38393845 } else if (t->hasDynamicSelfType ()) {
38403846 require (I->getFunction ()->hasSelfParam () ||
0 commit comments