core::fmt fails to optimize on arm-none-eabi #43369
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
WG-embedded
Working group: Embedded systems
While generating code for an Cortex-M0 I noticed that using core::fmt to generate printable output generates extremely bloated code, even when just using a plain string as format.
According to @rkruppe on IRC this is most likely due to a missed elimination of dead code by LTO.
A stripped down example can be found here:
https://gist.github.com/anonymous/7cfc8b881fcb8fdc792428dd772502cb
The generated assembly is here:
https://gist.github.com/anonymous/9cfa48e53e3b1c8ba1ddb69f8ae3ea3b
I also have an example (serial_slow_helloworld) in this repo https://github.com/therealprof/stm32f042.git .
xargo build --release --examples
will create a binary demonstrating the problem.This happens for me with:
The text was updated successfully, but these errors were encountered: