9
9
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
10
//
11
11
// ===----------------------------------------------------------------------===//
12
+ // /
13
+ // / Terminology:
14
+ // /
15
+ // / Simple liveness:
16
+ // / - Ends at lifetime-ending operations.
17
+ // / - Transitively follows guaranteed forwarding operations and address uses
18
+ // / within the current scope.
19
+ // / - Assumes inner scopes are complete, including borrow and address scopes
20
+ // / - Rarely returns AddressUseKind::PointerEscape.
21
+ // / - Per-definition dominance holds
22
+ // / - Insulates outer scopes from inner scope details. Maintains the
23
+ // / invariant that inlining cannot pessimize optimization.
24
+ // /
25
+ // / Transitive liveness
26
+ // / - Transitively follows uses within inner scopes, including forwarding
27
+ // / operations and address uses.
28
+ // / - Much more likely to returns AddressUseKind::PointerEscape
29
+ // / - Per-definition dominance holds
30
+ // / - Does not assume that any scopes are complete.
31
+ // /
32
+ // / Extended liveness (copy-extension and reborrow-extension)
33
+ // / - Extends a live range across lifetime-ending operations
34
+ // / - Depending on context: owned values are extended across copies or
35
+ // / guaranteed values are extended across reborrows
36
+ // / - Copy-extension is used to canonicalize an OSSA lifetime
37
+ // / - Reborrow-extension is used to check borrow scopes relative to its inner
38
+ // / uses and outer lifetime
39
+ // / - Per-definition dominance does not hold
40
+ // /
41
+ // ===----------------------------------------------------------------------===//
12
42
13
43
#ifndef SWIFT_SIL_OWNERSHIPUTILS_H
14
44
#define SWIFT_SIL_OWNERSHIPUTILS_H
@@ -30,7 +60,7 @@ class SILInstruction;
30
60
class SILModule ;
31
61
class SILValue ;
32
62
class DeadEndBlocks ;
33
- class PrunedLiveness ;
63
+ class MultiDefPrunedLiveness ;
34
64
struct BorrowedValue ;
35
65
36
66
// / Returns true if v is an address or trivial.
@@ -566,8 +596,10 @@ struct BorrowedValue {
566
596
567
597
bool isLocalScope () const { return kind.isLocalScope (); }
568
598
569
- // / Add this scopes live blocks into the PrunedLiveness result.
570
- void computeLiveness (PrunedLiveness &liveness) const ;
599
+ // / Add this scope's live blocks into the PrunedLiveness result. This
600
+ // / includes reborrow scopes that are reachable from this borrow scope but not
601
+ // / necessarilly dominated by the borrow scope.
602
+ void computeTransitiveLiveness (MultiDefPrunedLiveness &liveness) const ;
571
603
572
604
// / Returns true if \p uses are completely within this borrow introducer's
573
605
// / local scope.
@@ -580,8 +612,8 @@ struct BorrowedValue {
580
612
// /
581
613
// / \p deadEndBlocks is optional during transition. It will be completely
582
614
// / removed in an upcoming commit.
583
- bool areUsesWithinTransitiveScope (ArrayRef<Operand *> uses,
584
- DeadEndBlocks *deadEndBlocks) const ;
615
+ bool areUsesWithinExtendedScope (ArrayRef<Operand *> uses,
616
+ DeadEndBlocks *deadEndBlocks) const ;
585
617
586
618
// / Given a local borrow scope introducer, visit all non-forwarding consuming
587
619
// / users. This means that this looks through guaranteed block arguments. \p
0 commit comments