Skip to content

Commit 8fde305

Browse files
committed
[ownership-verifier] When checking uses, make sure to treat sources of assign/store that are trivially typed as trivial.
Noticed while working through SILGen. rdar://29791263
1 parent 22b49d2 commit 8fde305

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/SIL/SILOwnershipVerifier.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,24 @@ OwnershipCompatibilityUseChecker::visitBuiltinInst(BuiltinInst *I) {
519519

520520
OwnershipUseCheckerResult
521521
OwnershipCompatibilityUseChecker::visitAssignInst(AssignInst *I) {
522-
if (getValue() == I->getSrc())
522+
if (getValue() == I->getSrc()) {
523+
if (isAddressOrTrivialType()) {
524+
return {compatibleWithOwnership(ValueOwnershipKind::Trivial), false};
525+
}
523526
return {compatibleWithOwnership(ValueOwnershipKind::Owned), true};
527+
}
528+
524529
return {true, false};
525530
}
526531

527532
OwnershipUseCheckerResult
528533
OwnershipCompatibilityUseChecker::visitStoreInst(StoreInst *I) {
529-
if (getValue() == I->getSrc())
534+
if (getValue() == I->getSrc()) {
535+
if (isAddressOrTrivialType()) {
536+
return {compatibleWithOwnership(ValueOwnershipKind::Trivial), false};
537+
}
530538
return {compatibleWithOwnership(ValueOwnershipKind::Owned), true};
539+
}
531540
return {true, false};
532541
}
533542

0 commit comments

Comments
 (0)