-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Using the backtrace
crate worsens codegen when building with opt-level='s'
#111959
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
Comments
I've done some further investigation, trying to track this down. I'm not much practiced at compiler development, so this information might not actually be helpful. Here's what I found:
- %_9 = load ptr, ptr %self, align 8, !nonnull !2, !align !4, !noundef !2
+ %_9 = load ptr, ptr %self, align 8, !nonnull !2, !align !3, !noundef !2 I have no idea why the presence of miniz_oxide's I hope this information is helpful somehow, or at least interesting. |
Does |
It does! |
…homcc Add #[inline] to array TryFrom impls I was looking into rust-lang#111959 and I realized we don't have these. They seem like an uncontroversial addition. IMO this PR does not fix that issue. I think the bad codegen is being caused by some underlying deeper problem but this change might cause the MIR inliner to paper over it in this specific case. r? `@thomcc`
Add #[inline] to array TryFrom impls I was looking into rust-lang/rust#111959 and I realized we don't have these. They seem like an uncontroversial addition. IMO this PR does not fix that issue. I think the bad codegen is being caused by some underlying deeper problem but this change might cause the MIR inliner to paper over it in this specific case. r? `@thomcc`
My apologies if this is a known issue. I wanted to see whether the compiler would
optimize the following code in the way that I expected:
It worked just fine, and compiled it down to a few simple instructions (according to cargo show-asm):
But when I tried the same code in my own project, it generated a much worse implementation.
After some experimentation, I found that I could reproduce the issue by changing my test code as follows:
With these changes, I got significantly worse code:
Note that ALL of the changes are necessary to see the problem: I had to add the backtrace crate, I had to use it in the code, and I had to set
opt-level = 's'
.I've reproduced this behavior with the following versions of Rust:
Thanks for taking a look at this!
The text was updated successfully, but these errors were encountered: