Skip to content

Commit 3950ada

Browse files
authored
Merge pull request #6872 from gottesmm/assign_store_of_trivial
[ownership-verifier] When checking uses, make sure to treat sources of assign/store that are trivially typed as trivial.
2 parents 73a9933 + 8fde305 commit 3950ada

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
@@ -521,15 +521,24 @@ OwnershipCompatibilityUseChecker::visitBuiltinInst(BuiltinInst *I) {
521521

522522
OwnershipUseCheckerResult
523523
OwnershipCompatibilityUseChecker::visitAssignInst(AssignInst *I) {
524-
if (getValue() == I->getSrc())
524+
if (getValue() == I->getSrc()) {
525+
if (isAddressOrTrivialType()) {
526+
return {compatibleWithOwnership(ValueOwnershipKind::Trivial), false};
527+
}
525528
return {compatibleWithOwnership(ValueOwnershipKind::Owned), true};
529+
}
530+
526531
return {true, false};
527532
}
528533

529534
OwnershipUseCheckerResult
530535
OwnershipCompatibilityUseChecker::visitStoreInst(StoreInst *I) {
531-
if (getValue() == I->getSrc())
536+
if (getValue() == I->getSrc()) {
537+
if (isAddressOrTrivialType()) {
538+
return {compatibleWithOwnership(ValueOwnershipKind::Trivial), false};
539+
}
532540
return {compatibleWithOwnership(ValueOwnershipKind::Owned), true};
541+
}
533542
return {true, false};
534543
}
535544

0 commit comments

Comments
 (0)