@@ -8353,6 +8353,11 @@ class UncheckedOwnershipConversionInst
83538353 }
83548354};
83558355
8356+ enum class MarkDependenceKind {
8357+ Unresolved, Escaping, NonEscaping
8358+ };
8359+ static_assert (2 == SILNode::NumMarkDependenceKindBits, " Size mismatch" );
8360+
83568361// / Indicates that the validity of the first operand ("the value") depends on
83578362// / the value of the second operand ("the base"). Operations that would destroy
83588363// / the base must not be moved before any instructions which depend on the
@@ -8397,12 +8402,10 @@ class MarkDependenceInst
83978402
83988403 MarkDependenceInst (SILDebugLocation DebugLoc, SILValue value, SILValue base,
83998404 ValueOwnershipKind forwardingOwnershipKind,
8400- bool isNonEscaping )
8405+ MarkDependenceKind dependenceKind )
84018406 : InstructionBase(DebugLoc, value->getType (), forwardingOwnershipKind),
84028407 Operands{this , value, base} {
8403- if (isNonEscaping) {
8404- sharedUInt8 ().MarkDependenceInst .nonEscaping = true ;
8405- }
8408+ sharedUInt8 ().MarkDependenceInst .dependenceKind = uint8_t (dependenceKind);
84068409 }
84078410
84088411public:
@@ -8422,8 +8425,19 @@ class MarkDependenceInst
84228425 ArrayRef<Operand> getAllOperands () const { return Operands.asArray (); }
84238426 MutableArrayRef<Operand> getAllOperands () { return Operands.asArray (); }
84248427
8428+ MarkDependenceKind dependenceKind () const {
8429+ return MarkDependenceKind (sharedUInt8 ().MarkDependenceInst .dependenceKind );
8430+ }
8431+
84258432 bool isNonEscaping () const {
8426- return sharedUInt8 ().MarkDependenceInst .nonEscaping ;
8433+ return dependenceKind () == MarkDependenceKind::NonEscaping;
8434+ }
8435+
8436+ // / An unresolved escape is semantically an escaping dependence, but this
8437+ // / form is only valid prior to lifetime dependence diagnostics which will
8438+ // / convert it to NonEscaping if the program is valid.
8439+ bool hasUnresolvedEscape () const {
8440+ return dependenceKind () == MarkDependenceKind::Unresolved;
84278441 }
84288442
84298443 // / Visit the instructions that end the lifetime of an OSSA on-stack closure.
0 commit comments