-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
codegen: use new {re,de,}allocator annotations in llvm #99574
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikic (or someone else) soon. Please see the contribution instructions for more information. |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
054147d
to
5e9f978
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
As you've found out, we should have a separate test with min-llvm-version for testing the attributes.
I ended up making "llvm14" variants of the tests that don't have any llvm-15 specific stuff, and marking the "main" tests as requiring LLVM 15, with an eye towards deleting the old-llvm version and only really having to think about the LLVM 15 flavor fairly soon. Also, we have zero tests that emit __rust_realloc, but I have no idea how one would make that happen. |
This comment has been minimized.
This comment has been minimized.
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.
Looks good to me. Can you please squash the commits?
☔ The latest upstream changes (presumably #98208) made this pull request unmergeable. Please resolve the merge conflicts. |
bb21871
to
88afb16
Compare
Squashed as requested |
Also needs a rebase :) |
88afb16
to
6b611ea
Compare
ugh, I thought I had. I must have held git wrong somehow. |
@bors r+ rollup=never |
📌 Commit 6b611ead820d00af78f0c5a410ada1007b305a36 has been approved by It is now in the queue for this repository. |
⌛ Testing commit 6b611ead820d00af78f0c5a410ada1007b305a36 with merge 9cbe145955675f6101de19d1f567e69a0fccda02... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
This obviates the patch that teaches LLVM internals about _rust_{re,de}alloc functions by putting annotations directly in the IR for the optimizer. The sole test change is required to anchor FileCheck to the body of the `box_uninitialized` method, so it doesn't see the `allocalign` on `__rust_alloc` and get mad about the string `alloca` showing up. Since I was there anyway, I added some checks on the attributes to prove the right attributes got set. While we're here, we also emit allocator attributes on __rust_alloc_zeroed. This should allow LLVM to perform more optimizations for zeroed blocks, and probably fixes rust-lang#90032. [This comment](rust-lang#24194 (comment)) mentions "weird UB-like behaviour with bitvec iterators in rustc_data_structures" so we may need to back this change out if things go wrong. The new test cases require LLVM 15, so we copy them into LLVM 14-supporting versions, which we can delete when we drop LLVM 14.
6b611ea
to
130a1df
Compare
Updated to not require i64 sizes in the allocator functions. Should pass on both 32 and 64 bit now. 😄 |
@bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (4d6d601): comparison url. Instruction count
Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
LLVM 15 compatibility fixes These are LLVM 15 compatibility fixes split out from rust-lang#99464. There are three changes here: * Emit elementtype attribtue for ldrex/strex intrinsics. This is requires as part of the opaque pointers migration. * Make more tests compatible with opaque pointers. These are either new or aren't run on x86. * Remove a test for `#[rustc_allocator]`. Since rust-lang#99574 there are more requirement on the function signature. I dropped the test entirely, since we already test the effect of the attribute elsewhere. * The main change: When a worker thread emits an error, wait for other threads to finish before unwinding the main thread and exiting. Otherwise workers may end up using globals for which destructors have already been run. This was probably never quite correct, but became an active problem with LLVM 15, because it started using global dtors in critical places, as part of ManagedStatic removal. Fixes rust-lang#99432 (and probably also rust-lang#95679). r? `@cuviper`
This obviates the patch that teaches LLVM internals about
rust{re,de}alloc functions by putting annotations directly in the IR
for the optimizer.
The sole test change is required to anchor FileCheck to the body of the
box_uninitialized
method, so it doesn't see theallocalign
on__rust_alloc
and get mad about the stringalloca
showing up. Since Iwas there anyway, I added some checks on the attributes to prove the
right attributes got set.
r? @nikic