-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
rustc_trans: approximate ABI alignment for padding/union fillers. #46623
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
So this needs some tests:
|
@bors try |
⌛ Trying commit 343ac09df10e16ac241e90822b4648f92a5bdf1d with merge e714aa603990186aef4f596bca9e7a63c890d6ef... |
Perf for the reduced test case added to |
☀️ Test successful - status-travis |
Not completely fixed yet.Manually comparing the build time of the reduced test case (with
The numbers are better but still exponential. Meta
|
@kennytm Okay, I can confirm that, I was testing with the reduced testcase, do you happen to have something in between? It's not like there should be any cross-crate effects here. |
@eddyb sorry I don’t understand what you do mean by “in between” 😕. I just ran |
@kennytm I meant reduction-wise. I think I can try myself by adding the code of the test to the futures library and go from there. EDIT: Oh I think one of the |
52a49d8
to
30f45a1
Compare
if wanted == candidate.align(dl).abi() && wanted == candidate.size().bytes() |
Added a couple more assertions, although I'd be surprised if they fire at all. |
@bors r+ |
📌 Commit 8a26e04 has been approved by |
@eddyb Do we still need to backport this? |
if wanted == candidate.align(dl).abi() && wanted == candidate.size().bytes() not having the size stated seems to be very dangerous. Is there a reason for this or was it just missed? |
@xerofoify I'm sorry but I don't understand what you mean. The code you quote is in a function that hasn't changed behavior at all (was just simplified now that |
If that's the case then it's fine. That just seems to be a common mistake I see when refactoring code or fixing a regression. These can cause another regression but if you and I hope state that the refactor is correct it doesn't cause another regression. Not that I don't trust you but it's so common alongside doing double frees on error paths in C/C++ projects I was very skeptical about it. |
@xerofoify I really don't see what could possibly be the problem you're pointing to. The change in that function isn't meant to fix anything or modify its behavior, it's purely aesthetic. |
Fine then if it's just that it's OK. |
rustc_trans: approximate ABI alignment for padding/union fillers. Before #45225 and after this PR, unions and enums are filled with integers of size and alignment matching their alignment (e.g. `Option<u32>` becomes `[u32; 2]`) instead of mere bytes. Also, the alignment padding between struct fields gets this treatment after this PR. Partially helps with some reduced testcases in #46449, although it doesn't solve the bug itself.
☀️ Test successful - status-appveyor, status-travis |
I don't think we want to backport this until we find a solution to #46897 |
@arielb1 But this was supposed to improve performance. If only LLVM didn't care about pointees... |
Looks like we forgot to backport this for 1.23.0 (sorry about that!) so removing beta tags |
@alexcrichton #45225 was backed out from that beta (IIUC) so there wasn't anything to backport. |
Ah ok, great! |
Before #45225 and after this PR, unions and enums are filled with integers of size and alignment matching their alignment (e.g.
Option<u32>
becomes[u32; 2]
) instead of mere bytes.Also, the alignment padding between struct fields gets this treatment after this PR.
Partially helps with some reduced testcases in #46449, although it doesn't solve the bug itself.