Open
Description
Hi, I found a suboptimal code generation while inlining some struct functions starting from Rust 1.82.0 (including nightly).
Here's a link to a compiler explorer minimal example:
https://godbolt.org/z/WKqMr1fE7
In Rust < 1.82.0 the code is optimized correctly, while in versions above the code is different and an inefficient imul
instruction appears, causing a major performance drop during execution.
It seems that the problem is already present in the generated llvm IR (generated with --emit=llvm-ir
).
I tested various configurations in Rust 1.82.0:
- Debug symbols disabled => suboptimal
TestStruct
without#[repr(C)]
and-C debuginfo=2
=> suboptimalTestStruct
with#[repr(C)]
and-C debuginfo=2
=> correct
I also uploaded the code to github:
https://github.com/Guilucand/rust-inlining-bug
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Category: An issue highlighting optimization opportunities or PRs implementing suchIssue: Problems and improvements with respect to performance of generated code.Relevant to the compiler team, which will review and decide on the PR/issue.