Inefficient codegen in builder pattern with existed copyable base value #130592
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
P-medium
Medium priority
regression-untriaged
Untriaged performance or correctness regression.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
First found in #128081 (comment)
In a builder pattern code, when building with existed copyable base value, codegen isn't efficient like partial copy.
This can be reproduced on both argument value and constant value.
Full copy and patial copy:
C version: https://godbolt.org/z/z3fWsKhqE
Rust version: https://godbolt.org/z/MeGf8E5Gd
Existed value and non existed value:
C version: https://godbolt.org/z/9z3x3Kv5c
Rust version: https://godbolt.org/z/vWEaEfd3e
Real use case examaple in rust: https://godbolt.org/z/3q9jn5c1o
The text was updated successfully, but these errors were encountered: