-
Notifications
You must be signed in to change notification settings - Fork 13.8k
rustc_codegen_llvm: Feature Conversion Tidying #146615
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
base: master
Are you sure you want to change the base?
rustc_codegen_llvm: Feature Conversion Tidying #146615
Conversation
255b456
to
6538711
Compare
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.
Why do you switch from "The author" 3rd-person-self-reference to "I"?
Is this anything but just churn?
Did you ask a machine to output the PR description text according to a prompt and then paste it in?
As someone who has made several PRs and landed them, most of them on an arch-by-arch basis, you should already know this organization strategy doesn't make sense. |
As a commit message, I would prefer 3rd person self "the author" and "I" are only used inside |
@workingjubilee What about commits 1 through 3? If they are working for you, I will separate this PR into (a) commit 1–3 and (b) heavily modified commit 5 (sorted only by the architecture). |
6361abc looks fine. The merged matches are probably fine. Otherwise my remark about comparing against the 3-tuple instead of |
Understood, taking another approach (sort only by the architecture) in the next submission. |
If you personally prefer something like |
I changed the PR to use dedicated variable ( |
6538711
to
88a6742
Compare
Update (reflected comments by @workingjubilee):
|
88a6742
to
1f95f4d
Compare
This comment has been minimized.
This comment has been minimized.
I'll wait for status update regarding #145071, which will heavily affect this PR. |
☔ The latest upstream changes (presumably #146666) made this pull request unmergeable. Please resolve the merge conflicts. |
It makes LLVM version comparison clearer.
This commit simplifies construction of `arch` from `sess.target.arch`. It also preserves a reference to `sess.target.arch` as `raw_arch` to make this function future proof.
For maintainability, this commit reorders target feature conversion cases by the architecture.
1f95f4d
to
a1a3cd0
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Update: After #145071 is merged, this PR got a lot smaller. I added a commit to sort match clauses with the architecture (originally commit 5 but I took approach 1 (sort only by arch) instead of 2 (sort by category, then arch) in the initial submission). |
Thanks. @bors r+ rollup |
The author thinks we can improve
to_llvm_features
, a function to convert a Rust target feature name into an LLVM feature (or nothing, to ignore features unsupported by LLVM) for better maintainability.This PR attempts to resolve some of them by tidying many cases.
OUTDATED CONTENTS FOLLOW
Commit Groups
There are three kinds of changes in this PR:
I think merging them should be (simply) okay.
While many would accept, some changes might break the intent of the original author(s).
I'll describe this later.
To reviewers: I would like to hear which commits you can accept (if not all).
Reordering (Commit 5)
While match clauses of the current implementation seem too random, I think there are multiple choices to take.
It's simpler and we don't need to separate
avx10.1
andavx10.2
into two different subsections. However, we will have similar match clauses for pretty much the same purpose (to filter out features unsupported by LLVM) in multiple places.If we go with it, there are some cases we will have to separate similar target features into multiple categories (like
avx10.1
with simple renaming andavx10.2
with LLVM version filter + renaming (considered complex) inx86
). Instead, we will have a clear view of what's going to happen on the specific target feature.I chose (2) but (1) is definitely a good option, too.