Increased code size due to unnecessary memcpy libcall in MaybeUninit::assume_init
#96487
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-heavy
Issue: Problems and improvements with respect to binary size of generated code.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
After updating the compiler toolchain, I noticed that my binary got about 100 bytes larger. In my extremely size constrained environment, this is an increase of 5%. After a lot of minimizing, I tracked the main increase down to
MaybeUninit::assume_init
. It adds a new call to libc'smemcpy
. As far as I can tell, the code is moving the value on the stack a few bytes around, which is pointless (alignment should not be the issue here).This might be related to #61011
Code
Godbolt link
Version it worked on
The last version I got it to run on was
nightly-2022-02-01
, but it might be working until as late as2022-02-28
(I had some unrelated compile errors that made bisecting hard).Version with regression
The older nightly with regression is
2022-03-12
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: