5.9: [FieldSensitivePL] Fix vectorization. #66735
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description: Fix (and enable fixing) a class of miscompiles in the move-only address checker.
The move-only address checker relies heavily on FieldSensitivePrunedLiveness (FSPL), a vectorization of PrunedLiveness (PL). FSPL of width N needs to be able to represent exactly the same information as N copies of PL. In particular, for any instruction, must be able to be a non-user, a non-consuming user, or a consuming user of each of the N fields.
Previously, however, that was not true. FSPL stored a range
[i, i+k)
of elements at which a given instruction was live. Additionally it stored only a single bit for whether the instruction did or did not consume that range.The result was incorrect liveness computations in cases where disjoint fields were used, such as
and in cases where not all the fields had the same consumed-ness
(In the above,
S
is a move-only struct with three fields, f1, f2, f3 in that order.)The fix is to change the record corresponding to an instruction to have enough information to store all these possibilities. Here, the representation of two bit vectors of length N, one for live-at and a second for consumed-at, is implemented.
Risk: Low. The fix is involved, but the current behavior is definitely wrong.
Scope: Narrow. This only affects move-only types.
Original PR: #66690
Reviewed By: Andrew Trick ( @atrick )
Testing: Current unit tests and two new tests which were previously miscompiled--though note that a second patch will be necessary to fix the second of these two.
Resolves: rdar://110909290