forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 319
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
[EDS] LLVM support for new conditional runtime records #8588
Open
NuriAmari
wants to merge
3
commits into
apple:stable/20230725
Choose a base branch
from
NuriAmari:resilient-conditional-runtime-records
base: stable/20230725
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[EDS] LLVM support for new conditional runtime records #8588
NuriAmari
wants to merge
3
commits into
apple:stable/20230725
from
NuriAmari:resilient-conditional-runtime-records
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Teach the dead stripping in LLD for MachO how to parse conditionally live records, and consider them when dead stripping. This is a demonstrative patch of a change that could made for LLD for ELF/COFF or other linkers to support effective EDS without LTO.
During thin-LTO thin-link, a global liveness analysis is performed to guide importing and exporting decisions between modules. EDS is far more effective when it can operate on the entire LTO unit, otherwise dependencies defined in other modules have to be conservatively assumed live. It is also far simpler to safely run EDS on the entire LTO unit, since otherwise it can be difficult to determine if the liveness of a copy of a dependency is representative of the liveness of the entity in the program as a whole. Lastly, just like regular DCE, EDS is more effective run multiple times. In this patch, we serialize EDS information (stripping conditions) into each module's summary, then collect this information during thin-link, making liveness decisions accordingly. We support both the old and new LTO backend.
NuriAmari
commented
Apr 17, 2024
@@ -1,17 +0,0 @@ | |||
; RUN: opt -S -passes=globaldce < %s | FileCheck %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test tested what happens when the metadata contains null dependencies, which is now impossible.
NuriAmari
force-pushed
the
resilient-conditional-runtime-records
branch
from
April 17, 2024 21:26
670e932
to
ce4cdb3
Compare
Corresponding forum post: https://forums.swift.org/t/rfc-conditional-runtime-records-revamped/71326 |
NuriAmari
force-pushed
the
resilient-conditional-runtime-records
branch
from
April 18, 2024 17:53
ce4cdb3
to
b28c6d8
Compare
In this patch, we replace the old EDS logic in GlobalDCE, with new logic that knows how to interpret the new conditionally live records. We prevent this stripping logic from running before full-LTO merge, as it's unclear if it is safe to evaluate the liveness of a dependency without considering the full LTO unit. The primary concern here is when a dependency has multiple defintions, each internalized into different modules. The liveness of one may not reflect the liveness of another.
NuriAmari
force-pushed
the
resilient-conditional-runtime-records
branch
from
April 18, 2024 22:49
b28c6d8
to
8f4c2fa
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds the required LLVM support for the new form of conditional runtime records proposed in apple/swift#73060.