Skip to content

Commit 33ebf80

Browse files
committed
Update verification for unchecked_ownership
1 parent 1dc5c96 commit 33ebf80

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/SIL/Verifier/SILOwnershipVerifier.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ bool SILValueOwnershipChecker::gatherUsers(
346346
Operand *op = uses.pop_back_val();
347347
SILInstruction *user = op->getUser();
348348

349+
if (isa<UncheckedOwnershipInst>(user)) {
350+
continue;
351+
}
352+
349353
// If this op is a type dependent operand, skip it. It is not interesting
350354
// from an ownership perspective.
351355
if (user->isTypeDependentOperand(*op))

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6711,6 +6711,11 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
67116711
"Result and operand must have the same type, today.");
67126712
}
67136713

6714+
void checkUncheckedOwnershipInst(UncheckedOwnershipInst *uoi) {
6715+
require(F.getModule().getStage() == SILStage::Raw,
6716+
"unchecked_ownership is valid only in raw SIL");
6717+
}
6718+
67146719
void checkAllocPackMetadataInst(AllocPackMetadataInst *apmi) {
67156720
require(apmi->getIntroducer()->mayRequirePackMetadata(*apmi->getFunction()),
67166721
"Introduces instruction of kind which cannot emit on-stack pack "

0 commit comments

Comments
 (0)