Skip to content

Commit 9c887a1

Browse files
committed
[MoveAddrChecker] Init'd looks thru mark_depend.
Extend the hack to determine whether an address begins initialized to look through mark_dependence instructions.
1 parent 0b47442 commit 9c887a1

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerUtils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,11 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
993993
// derivable from the CheckKind of the mark instruction.
994994

995995
SILValue operand = address->getOperand();
996+
997+
if (auto *mdi = dyn_cast<MarkDependenceInst>(operand)) {
998+
operand = mdi->getValue();
999+
}
1000+
9961001
{
9971002
// Then check if our markedValue is from an argument that is in,
9981003
// in_guaranteed, inout, or inout_aliasable, consider the marked address to

test/SILOptimizer/moveonly_addresschecker.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
2-
// RUN: %target-swift-emit-sil -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
1+
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature NonescapableTypes %s -Xllvm -sil-print-final-ossa-module | %FileCheck %s
2+
// RUN: %target-swift-emit-sil -O -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature NonescapableTypes %s
33

44
// This file contains tests that used to crash due to verifier errors. It must
55
// be separate from moveonly_addresschecker_diagnostics since when we fail on
@@ -46,3 +46,18 @@ struct S
4646
fatalError()
4747
}
4848
}
49+
50+
struct TestCoroAccessorOfCoroAccessor<T : ~Escapable> : ~Copyable & ~Escapable {
51+
var t: T
52+
53+
var inner: TestCoroAccessorOfCoroAccessor<T> {
54+
_read {
55+
fatalError()
56+
}
57+
}
58+
var outer: TestCoroAccessorOfCoroAccessor<T> {
59+
_read {
60+
yield inner
61+
}
62+
}
63+
}

0 commit comments

Comments
 (0)