-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Replace NullOp::SizeOf and NullOp::AlignOf by lang items. #147793
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
Conversation
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Replace NullOp::SizeOf and NullOp::AlignOf by lang items.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (2cefd8f): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.3%, secondary -1.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.9%, secondary 6.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 475.105s -> 474.369s (-0.15%) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
fca4c69 to
27154a0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
| let ty = self.monomorphize(ty); | ||
| let layout = bx.cx().layout_of(ty); | ||
| let val = match null_op { | ||
| mir::NullOp::SizeOf => { |
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.
(No action) I do like that this means the different backends don't need this any more, which is nice since it all needs to match what CTFE did anyway 👍
| _2 = SizeOf(S); | ||
| _3 = AlignOf(S); | ||
| _4 = alloc::alloc::exchange_malloc(move _2, move _3) -> [return: bb1, unwind continue]; | ||
| _2 = alloc::alloc::exchange_malloc(const <S as std::mem::SizedTypeProperties>::SIZE, const <S as std::mem::SizedTypeProperties>::ALIGN) -> [return: bb1, unwind continue]; |
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.
Lovely to see this inline and no longer need the locals 👍
| + _4 = const 4_usize; | ||
| + _5 = const 4_usize; | ||
| + _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> [return: bb1, unwind unreachable]; | ||
| _4 = alloc::alloc::exchange_malloc(const <i32 as std::mem::SizedTypeProperties>::SIZE, const <i32 as std::mem::SizedTypeProperties>::ALIGN) -> [return: bb1, unwind unreachable]; |
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.
Just confirming: the reason this is still the const, rather than 4_usize is that this is a GVN unit test? Some other pass is going to evaluate it in the normal flow, right?
Or does it not matter because anything asking for try_eval_target_usize on the const will get the value either way?
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.
Oh, that's because GVN avoids to evaluate constants in-place. That does not really matter, any code that needs to evaluate it will easily. If we need it, it's a 3-line change in GVN, but I'd rather do it in a separate PR.
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.
I definitely don't think it's GVN's problem. If it's useful to do, I'd probably do it in InstSimplify or something, since it could be done locally. Agreed no need for it in this PR.
And TBH I don't know how important it is. I did a bit more digging, and it looks like try_eval_target_usize will end up in const_eval_resolve+const_eval_global_id, so probably anyone looking at the constant will get the value they need anyway, so might not be worth bothering.
(I don't know if there are paths that only look at Const::Val and skip Const::Unevaluated, though. I guess we can always worry about that later if needed.)
So I think this can be "won't fix"ed.
| /// Returns the size of a value of that type. | ||
| SizeOf, | ||
| /// Returns the minimum alignment of a type. | ||
| AlignOf, |
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.
FYI @celinval
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.
I left some comments along the way, but this looks good to me. r=me with minor updates to address things if you see fit. (Or wait for oli if you think this should go through someone more knowledgeable about const stuff.)
|
☔ The latest upstream changes (presumably #147687) made this pull request unmergeable. Please resolve the merge conflicts. |
|
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. |
|
@bors r=scottmcm,oli-obk |
|
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 7838ce1 (parent) -> 4b3ba58 (this PR) Test differencesShow 52 test diffsStage 1
Stage 2
Additionally, 40 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 4b3ba5844e8831c9b3ee5a5643cdff5da0677426 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (4b3ba58): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.1%, secondary 1.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 1.3%, secondary -1.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 473.667s -> 474.933s (0.27%) |
Relevant upstream PR: - rust-lang/rust#147793 (Replace NullOp::SizeOf and NullOp::AlignOf by lang items.) Resolves: model-checking#4425
Part of #146411
Fixes #119729
Keeps #136175 as it involves
offset_of!which this PR does not touch.r? @ghost