Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inefficient codegen in builder pattern with existed copyable base value #130592

Open
CrazyboyQCD opened this issue Sep 20, 2024 · 3 comments
Open
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.

Comments

@CrazyboyQCD
Copy link

CrazyboyQCD commented Sep 20, 2024

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

@CrazyboyQCD CrazyboyQCD added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Sep 20, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 20, 2024
@jieyouxu jieyouxu added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 20, 2024
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 25, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 12, 2024
@CrazyboyQCD
Copy link
Author

CrazyboyQCD commented Oct 21, 2024

Close this in favor of llvm/llvm-project#113134

@DianQK
Copy link
Member

DianQK commented Oct 21, 2024

We’d better keep it open until a test case for the fix is added to Rust.

@CrazyboyQCD CrazyboyQCD reopened this Oct 22, 2024
@CrazyboyQCD CrazyboyQCD changed the title Redundant instructions in cloning of bit-wise copyable type Inefficient codegen in builder pattern with existed copyable base value Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

6 participants