Skip to content

Commit 98e3f04

Browse files
authored
Merge pull request #22503 from gottesmm/pr-b879a0f3a55c6131ff071337356f4fd4bf7c955f
[sil] Tighten up SIL verification around when checked_cast_br should/…
2 parents cc1800d + 391762f commit 98e3f04

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/SIL/SILVerifier.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,20 +3381,17 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
33813381
CBI->getCastType(),
33823382
"success dest block argument of checked_cast_br must match type of "
33833383
"cast");
3384-
require(F.hasOwnership() || CBI->getFailureBB()->args_empty(),
3385-
"failure dest of checked_cast_br in unqualified ownership sil must "
3386-
"take no arguments");
3387-
#if 0
3388-
require(F.hasUnqualifiedOwnership() ||
3389-
CBI->getFailureBB()->args_size() == 1,
3384+
require(!F.hasOwnership() || CBI->getFailureBB()->args_size() == 1,
33903385
"failure dest of checked_cast_br must take one argument in "
33913386
"ownership qualified sil");
3392-
require(F.hasUnqualifiedOwnership() ||
3387+
require(!F.hasOwnership() ||
33933388
CBI->getFailureBB()->args_begin()[0]->getType() ==
33943389
CBI->getOperand()->getType(),
33953390
"failure dest block argument must match type of original type in "
33963391
"ownership qualified sil");
3397-
#endif
3392+
require(F.hasOwnership() || CBI->getFailureBB()->args_empty(),
3393+
"Failure dest of checked_cast_br must not take any argument in "
3394+
"non-ownership qualified sil");
33983395
}
33993396

34003397
void checkCheckedCastValueBranchInst(CheckedCastValueBranchInst *CBI) {

0 commit comments

Comments
 (0)