-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Apply noundef attribute to &T, &mut T, Box<T>, bool #93670
Conversation
This doesn't handle `char` because it's a bit awkward to distinguish it from u32 at this point in codegen. Note that for some types (like `&Struct` and `&mut Struct`), we already apply `dereferenceable`, which implies `noundef`, so the IR does not change.
@bors r+ rollup=never Extra attributes might have a compile-time impact. |
📌 Commit 75ed7de has been approved by |
⌛ Testing commit 75ed7de with merge a78ffefbccd8c5b80e5532af443c28f122a7716b... |
💔 Test failed - checks-actions |
This comment has been minimized.
This comment has been minimized.
…n on any host platform (with the right llvm components)
@bors r+ |
📌 Commit 4013077 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (5c30d65): comparison url. Summary: This benchmark run did not return any relevant results. 54 results were found to be statistically significant but too small to be relevant. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
This should likely have been labeled as perf regression. |
Indeed. Cachegrind indicates that it's simply due to the overhead of inserting the attribute itself:
LLVM 14 includes some performance improvements to AttrBuilder and attribute-related code, so after #93577 is merged I'll open a revert PR to see if the impact is still significant. |
At opt-level=0, apply only ABI-affecting attributes to functions This should provide a small perf improvement for debug builds, and should more than cancel out the perf regression from adding noundef (rust-lang#93670 (comment), rust-lang#94106). r? `@nikic`
Regression after LLVM 14 investigated in #94106, which reverts this PR, giving a potential savings of:
All of that is due to the cost of adding the
...which (more than) completely eliminates the regression in debug builds. The remaining potential savings from reverting this PR are only in opt builds, specifically:
The is just due to the overhead of inserting the |
This doesn't handle
char
because it's a bit awkward to distinguish it fromu32
at this point in codegen.Note that this does not change whether or not it is UB for
&
,&mut
, orBox
to point to undef. It only applies to the pointer itself, not the pointed-to memory.Fixes (partially) #74378.
r? @nikic cc @RalfJung