Skip to content

Missed optimization: Array shadowed in same scope of declaration unnecessarily copied. #72313

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

Open
PrototypeNM1 opened this issue May 18, 2020 · 3 comments
Labels
A-mir-opt Area: MIR optimizations A-mir-opt-nrvo Fixed by the Named Return Value Opt. (NRVO) C-enhancement Category: An issue proposing an enhancement or a PR with one. C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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.

Comments

@PrototypeNM1
Copy link
Contributor

PrototypeNM1 commented May 18, 2020

Edit: initial attempt at reducing the scope led to an incorrect example, updating with the motivating example.

https://rust.godbolt.org/z/g4imX-

The above shadow on line 119 let position_deltas = position_deltas; results in a series of vmovups, but should be optimized to a noop.

@jonas-schievink jonas-schievink added A-mir-opt-nrvo Fixed by the Named Return Value Opt. (NRVO) C-enhancement Category: An issue proposing an enhancement or a PR with one. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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. A-mir-opt Area: MIR optimizations labels May 18, 2020
@workingjubilee workingjubilee added the C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such label Oct 8, 2023
@moxian
Copy link
Contributor

moxian commented Mar 25, 2025

Fixed by #72205.
Mildly ironic, since that PR was already in flight by the time this issue was submitted, but it took us 5 years to figure this out

@moxian
Copy link
Contributor

moxian commented Mar 25, 2025

I don't think i have the perms, but let me try...

@rustbot close

@rustbot
Copy link
Collaborator

rustbot commented Mar 25, 2025

Error: The feature close is not enabled in this repository.
To enable it add its section in the triagebot.toml in the root of the repository.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations A-mir-opt-nrvo Fixed by the Named Return Value Opt. (NRVO) C-enhancement Category: An issue proposing an enhancement or a PR with one. C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example 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.
Projects
None yet
Development

No branches or pull requests

5 participants