-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Put noundef
on all scalars that don't allow uninit
#106294
Conversation
r? @oli-obk (rustbot has picked a reviewer for you, use r? to override) |
0162428
to
50d3253
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 50d325328bce3d3489a447c988558c9f88c80caf with merge 71266de2dfc6e16a09e705633d9ff32e86d0ab3c... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (71266de2dfc6e16a09e705633d9ff32e86d0ab3c): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
0ce2102
to
b774934
Compare
This comment has been minimized.
This comment has been minimized.
Drive-by perf analysis: Ignoring opt builds, the change is strictly positive ( Any time we give LLVM more information, LLVM's going to take more time to process that information. Given the improvements on non-opt builds, it seems likely this does result in better codegen. To my eye, the regressions to opt time seem reasonably justified by the improvements gotten from the new optimization potential. |
b774934
to
25c3235
Compare
Let's see what happens if we don't apply to on loads as suggested in #106294 (comment). I haven't adjusted the codegen tests but try doesn't care |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit a0b1c2866f4b30bde9fefb09aa97b861d5f775fc with merge 27e50c7f29cb52f18a29d138ed6d4d6a99689998... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
mean | range | count | |
---|---|---|---|
Regressions ❌ (primary) |
0.3% | [0.3%, 0.3%] | 1 |
Regressions ❌ (secondary) |
- | - | 0 |
Improvements ✅ (primary) |
- | - | 0 |
Improvements ✅ (secondary) |
- | - | 0 |
All ❌✅ (primary) | 0.3% | [0.3%, 0.3%] | 1 |
Max RSS (memory usage)
Results
This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
mean | range | count | |
---|---|---|---|
Regressions ❌ (primary) |
2.6% | [2.0%, 3.0%] | 3 |
Regressions ❌ (secondary) |
- | - | 0 |
Improvements ✅ (primary) |
- | - | 0 |
Improvements ✅ (secondary) |
- | - | 0 |
All ❌✅ (primary) | 2.6% | [2.0%, 3.0%] | 3 |
Cycles
This benchmark run did not return any relevant results for this metric.
well, that builder is green as well now. onto the next one! |
📌 Commit 82386840d1674b438f5f35efc68511ad21e982fa has been approved by It is now in the queue for this repository. |
⌛ Testing commit 82386840d1674b438f5f35efc68511ad21e982fa with merge 5916677c0e7704ae21521aa4ce69e115df8323aa... |
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
8238684
to
f125538
Compare
time for the next one! maybe we'll get through this time (also almost committed the changed try files, oops) |
☀️ Test successful - checks-actions |
Finished benchmarking commit (3984bc5): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
awesome look at all that green in the perf results! |
Cc @rust-lang/wg-unsafe-code-guidelines |
Previously, it was only put on scalars with range validity invariants like bool, was uninit was obviously invalid for those.
Since then, we have normatively declared all uninit primitives to be undefined behavior and can therefore put
noundef
on them.The remaining concern was the
mem::uninitialized
function, which cause quite a lot of UB in the older parts of the ecosystem. After #99182, this function now doesn't return uninit values anymore, making users of it safe from this change.The only real sources of UB where people could encounter uninit primitives are
MaybeUninit::uninit().assume_init()
, which has always be clear in the docs about being UB and from heap allocations (like reading from the spare capacity of a vec). This is hopefully rare enough to not break anything.cc @nagisa @scottmcm @nikic