Assembly for Rc::<str>::default() looks quite inefficient #135784
Labels
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected this to allocate with a known layout and and handle potential allocation errors.
Instead, before the allocation, the assembly contains not one, but two calls to
rc_inner_layout_for_value_layout
(indirect viacall r15
) (compiler explorer):The two calls seem to correspond to the source code (line 257 and 2076), but I would have expected the compiler to be smart enough to see those should be the same, and even to compute that value at compile time.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: