Skip to content

Commit 72d678a

Browse files
authored
Merge pull request swiftlang#62930 from gottesmm/pr-efb60a1d2ca0b9afbad155ff71bc636b76d3650d
Revert change to a comment.
2 parents f8d03a2 + b405782 commit 72d678a

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

include/swift/SIL/FieldSensitivePrunedLiveness.h

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,23 @@ namespace swift {
6262
/// Linearized Representation of Enums
6363
/// ----------------------------------
6464
///
65-
/// Since enums are sum types, our representation of enums must deal with the
66-
/// following problems:
67-
///
68-
/// 1. An enum can require different numbers of bits in its linearized
69-
/// representation depending on the payload of the case that the enum is
70-
/// initialized to.
71-
///
72-
/// 2. It is important that we be able to construct the exact enum case that our
73-
/// sub-element corresponds to. This implies we must in our representation store
74-
/// in some manner the actual case information. To do so, our representation
75-
/// uses 1 + log2(num enum cases) bits. The first bit shows
76-
///
77-
/// To work around this problem in our representation, we always
78-
/// store enough bits for the max sized payload of all cases of the enum and add
79-
/// an additional set of last bits for the discriminator. Any extra bits that
80-
/// may be needed (e.x.: we are processing a enum case with a smaller payload)
81-
/// are always assumed to be set to the same value that the initial
82-
/// discriminator bit is set to.
65+
/// Since enums are sum types, an enum can require different numbers of bits in
66+
/// its linearized representation depending on the payload of the case that the
67+
/// enum is initialized to. To work around this problem in our representation,
68+
/// we always store enough bits for the max sized payload of all cases of the
69+
/// enum and add an additional last bit for the discriminator. Any extra bits
70+
/// that may be needed (e.x.: we are processing a enum case with a smaller
71+
/// payload) are always assumed to be set to the same value that the
72+
/// discriminator bit is set to. This representation allows us to track liveness
73+
/// trading off the ability to determine information about the actual case that
74+
/// we are tracking. Since we just care about liveness, this is a trade off that
75+
/// we are willing to make since our goal (computing liveness) is still solved.
8376
///
8477
/// With the above paragraph in mind, an example of the bit layout of an enum
8578
/// looks as follows:
8679
///
8780
/// ```
88-
/// [ PAYLOAD BITS | EXTRA_TOP_LEVEL_BITS | DISCRIMINATOR_BITS ]
81+
/// [ PAYLOAD BITS | EXTRA_TOP_LEVEL_BITS | DISCRIMINATOR_BIT ]
8982
/// ```
9083
///
9184
/// Notice how placing the discriminator bit last ensures that separately the

0 commit comments

Comments
 (0)