Skip to content

Commit 1f29471

Browse files
authored
Merge pull request #69968 from tshortli/sil-verifier-crash
2 parents 3f06b5e + f208e4a commit 1f29471

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

include/swift/SIL/SILModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ class SILModule {
473473
SingleValueInstruction *
474474
getRootLocalArchetypeDefInst(CanLocalArchetypeType archetype,
475475
SILFunction *inFunction) {
476-
return cast<SingleValueInstruction>(
476+
return dyn_cast<SingleValueInstruction>(
477477
getRootLocalArchetypeDef(archetype, inFunction));
478478
}
479479

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,8 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
17031703
// the current function.
17041704
auto *openingInst = F.getModule().getRootLocalArchetypeDefInst(
17051705
root, AI->getFunction());
1706+
require(openingInst,
1707+
"Root opened archetype should be registered in SILModule");
17061708
require(openingInst == AI || properlyDominates(openingInst, AI),
17071709
"Use of a local archetype should be dominated by a "
17081710
"definition of this root opened archetype");

0 commit comments

Comments
 (0)