Incomplete optimization with opt-level=z compared to clang for possible pre-compiled expressions #102312
Labels
A-codegen
Area: Code generation
C-bug
Category: This is a bug.
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.
I noted that rust does not apply some size optimizations when
opt-level=z
is supplied, whereas inc
they are applied.See here: https://godbolt.org/z/1955WjcT8
I tried this code:
With
opt-level=3
With
opt-level=z
I would expect
opt-level=z
andopt-level=3
to have the same output for this fairly simple case.In contrast,
clang
15.0.0 does this:with
-O3
with
-Oz
Meta
rustc --version --verbose
:I understand that the c code is far easier to optimize, but nevertheless the rust-produced assembly code is about 7 x as long.
The text was updated successfully, but these errors were encountered: