Skip to content

[pruned-liveness] Make some small fixes that only are exposed when working with multi-bit code #62907

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Jan 7, 2023

I am fixing some issues that I discovered in FieldSensitive liveness which internally uses pruned live blocks. There are a few things that I did here that fix some architectural issues:

  1. Rather than attempting to perform operations all at once for multiple bits, we instead now just work one bit at a time. This simplifies the internal implementation and also more importantly allows me to specialize the internal implementation for single bit usage.
  2. I changed getBlockLiveness to only return enough block liveness for the requested bits. If we returned extra dead bits we perform computeUseBlockLiveness additional times for bits where we do not want to do so. This can cause weird propagation issues.

NOTE: This is an interim change. I plan on splitting PrunedLiveBlocks into two separate implementations in a subsequent commit. The first will take advantage of SILNodeBits and only handle single bits and we will have a separate FieldSensitive one that handles multiple bits.

… &) implementation.

For some reason LLVM doesn't provide this. I have written a few versions of this
in the Swift codebase. Makes sense to factor it out before I make another one.
…keys have been deleted from the mult-map.

This is useful to validate that a multi-map has been completely consumed as one
erases values from it.
… only one entry per live bit.

Previously, we would pan the array with isDead. The thinking is that this would
make it easier to bitmask directly against. In practice, this usage was a minor
use case and doing this lead to a bunch of logic mistakes in forthcoming code.
Just a small cleanup that will improve performance in the scalar case which is
important for OSSA utilities.
…e only scalar logic.

I did this by doing the following:

1. I renamed computeUseBlockLiveness to computeScalarUseBlockLiveness and
changed it to take a specific bit that it is testing for.

2. I changed the logic that already existed in this code path that worked scalar
by scalar to use scalar logic rather than call the broken multi-bit at a time
code path.

3. We took advantage of resultingFoundLiveness now only returning the requested
bits instead of all bits. This ensures that we do not run
computeScalarUseBlockLiveness for those unneeded dead bits resulting in liveness
being inappropriately propagated into predecessors.
…ion for each bit rather than attempt to do it for all bits at the same time.
@gottesmm gottesmm requested a review from atrick January 7, 2023 22:35
@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 7, 2023

@swift-ci test

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 7, 2023

The reason why I think this hasn't hit the main move only address impl is that I am now fixing how we hoist destroy_addr which exposes these issues when we have partially deinited structs.

@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 7, 2023

@swift-ci test

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It'll be great to separate the field sensitive code.

swift-ci pushed a commit that referenced this pull request Jan 8, 2023
[pruned-liveness] Make some small fixes that only are exposed when working with multi-bit code
@gottesmm
Copy link
Contributor Author

gottesmm commented Jan 8, 2023

I just merged this and I think GitHub hit an issue where it didn't realize the merge went through? I guess I am just going to close this PR.

@gottesmm gottesmm closed this Jan 8, 2023
@gottesmm gottesmm deleted the pruned-liveness-fixes branch January 8, 2023 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants