File tree Expand file tree Collapse file tree 5 files changed +499
-12
lines changed Expand file tree Collapse file tree 5 files changed +499
-12
lines changed Original file line number Diff line number Diff line change @@ -1424,9 +1424,9 @@ namespace {
1424
1424
EnumDecl *decl = enumType.getEnumOrBoundGenericEnum ();
1425
1425
assert (decl && " switch_enum operand is not an enum" );
1426
1426
1427
- // FIXME: Get expansion from SILFunction
1428
- if (!decl->isEffectivelyExhaustive (inst ->getModule ().getSwiftModule (),
1429
- ResilienceExpansion::Maximal )) {
1427
+ const SILFunction *F = inst-> getFunction ();
1428
+ if (!decl->isEffectivelyExhaustive (F ->getModule ().getSwiftModule (),
1429
+ F-> getResilienceExpansion () )) {
1430
1430
return nullptr ;
1431
1431
}
1432
1432
Original file line number Diff line number Diff line change @@ -3705,10 +3705,9 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3705
3705
}
3706
3706
3707
3707
// If the select is non-exhaustive, we require a default.
3708
- // FIXME: Get the resilience expansion from the function.
3709
3708
bool isExhaustive =
3710
3709
eDecl->isEffectivelyExhaustive (F.getModule ().getSwiftModule (),
3711
- ResilienceExpansion::Maximal );
3710
+ F. getResilienceExpansion () );
3712
3711
require ((isExhaustive && unswitchedElts.empty ()) || I->hasDefault (),
3713
3712
" nonexhaustive select_enum must have a default destination" );
3714
3713
if (I->hasDefault ()) {
@@ -3877,10 +3876,9 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
3877
3876
}
3878
3877
3879
3878
// If the switch is non-exhaustive, we require a default.
3880
- // FIXME: Get the resilience expansion from the function.
3881
3879
bool isExhaustive =
3882
3880
uDecl->isEffectivelyExhaustive (F.getModule ().getSwiftModule (),
3883
- ResilienceExpansion::Maximal );
3881
+ F. getResilienceExpansion () );
3884
3882
require ((isExhaustive && unswitchedElts.empty ()) || SOI->hasDefault (),
3885
3883
" nonexhaustive switch_enum must have a default destination" );
3886
3884
if (SOI->hasDefault ()) {
Original file line number Diff line number Diff line change @@ -317,10 +317,10 @@ void BBEnumTagDataflowState::handlePredCondSelectEnum(CondBranchInst *CondBr) {
317
317
// know the true branch must be the other tag.
318
318
if (EnumDecl *E = Operand->getType ().getEnumOrBoundGenericEnum ()) {
319
319
// We can't do this optimization on non-exhaustive enums.
320
- // FIXME: Get resilience expansion from the function.
320
+ const SILFunction *Fn = CondBr-> getFunction ();
321
321
bool IsExhaustive =
322
- E->isEffectivelyExhaustive (CondBr ->getModule ().getSwiftModule (),
323
- ResilienceExpansion::Maximal );
322
+ E->isEffectivelyExhaustive (Fn ->getModule ().getSwiftModule (),
323
+ Fn-> getResilienceExpansion () );
324
324
if (!IsExhaustive)
325
325
return ;
326
326
// Look for a single other element on this enum.
Original file line number Diff line number Diff line change @@ -1583,10 +1583,9 @@ bool SimplifyCFG::simplifyCondBrBlock(CondBranchInst *BI) {
1583
1583
EnumElementDecl *FirstElt = *Iter;
1584
1584
1585
1585
// We can't do this optimization on non-exhaustive enums.
1586
- // FIXME: Get the resilience expansion from the function.
1587
1586
bool IsExhaustive =
1588
1587
E->isEffectivelyExhaustive (Fn.getModule ().getSwiftModule (),
1589
- ResilienceExpansion::Maximal );
1588
+ Fn. getResilienceExpansion () );
1590
1589
1591
1590
if (IsExhaustive
1592
1591
&& SEI->getNumCases () >= 1
You can’t perform that action at this time.
0 commit comments