Match blocks generate inefficient assembly compared to if/else chain since rust 1.65.0 #110737
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.
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.
I would assume that the following two snippets of code would compile to identical assembly
However, as of rustc 1.65.0
convert_hex2
with thematch
blocks generates suboptimal code that is approximately 30% slower in a microbenchmark. Godbolt link showing asm comparison between 1.64.0 vs 1.69.0.I don't think it's an LLVM regression since the emitted IR differs between 1.64 and 1.65: https://rust.godbolt.org/z/7b3EbGfj3
Version it worked on
It most recently worked on: 1.64.0
Version with regression
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged +A-codegen +C-bug +T-compiler +I-slow
I'll try to bisect the commit behind the change.
The text was updated successfully, but these errors were encountered: