Skip to content

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Oct 17, 2025

Previously copy propagation presumed that there is further unspecified distinction between move operands and copy operands in assignments and propagated moves from assignments into terminators. This is inconsistent with current operational semantics.

Turn moves into copies after copy propagation to preserve existing behavior.

Fixes #137936.
Fixes #146423.

r? @cjgillot

@rustbot
Copy link
Collaborator

rustbot commented Oct 17, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 17, 2025
@tmiasko tmiasko changed the title Turns moves into copies after copy propagation Turn moves into copies after copy propagation Oct 17, 2025
@rust-log-analyzer

This comment has been minimized.

@tmiasko
Copy link
Contributor Author

tmiasko commented Oct 17, 2025

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 17, 2025
Turn moves into copies after copy propagation
@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 17, 2025
@rust-bors
Copy link

rust-bors bot commented Oct 17, 2025

💥 Test timed out after 21600s

@tmiasko
Copy link
Contributor Author

tmiasko commented Oct 17, 2025

@bors try

rust-bors bot added a commit that referenced this pull request Oct 17, 2025
Turn moves into copies after copy propagation
@rust-bors

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Oct 17, 2025

☀️ Try build successful (CI)
Build commit: 09003ac (09003acc28104d3fbe9b443536d97a793f68ffde, parent: f46475914de626785090a05ae037578aaa119fc8)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (09003ac): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
1.2% [0.2%, 3.6%] 39
Regressions ❌
(secondary)
1.8% [0.3%, 10.1%] 21
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) 1.2% [0.2%, 3.6%] 39

Max RSS (memory usage)

Results (primary 1.5%, secondary 4.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.5% [1.5%, 1.5%] 1
Regressions ❌
(secondary)
4.1% [4.1%, 4.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.5% [1.5%, 1.5%] 1

Cycles

Results (primary -0.5%, secondary 5.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.6% [1.6%, 1.6%] 1
Regressions ❌
(secondary)
5.5% [3.5%, 8.9%] 4
Improvements ✅
(primary)
-2.6% [-2.6%, -2.6%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-2.6%, 1.6%] 2

Binary size

Results (primary 0.7%, secondary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.7% [0.0%, 3.3%] 63
Regressions ❌
(secondary)
0.2% [0.0%, 0.8%] 30
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.0%, 3.3%] 63

Bootstrap: 475.372s -> 475.243s (-0.03%)
Artifact size: 390.39 MiB -> 390.39 MiB (0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 17, 2025
@tmiasko tmiasko marked this pull request as draft October 18, 2025 12:24
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2025
@tmiasko tmiasko force-pushed the move-copy branch 2 times, most recently from 4ae2c39 to 391b45e Compare October 18, 2025 13:15
@tmiasko
Copy link
Contributor Author

tmiasko commented Oct 18, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Oct 18, 2025
Turn moves into copies after copy propagation
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 18, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Oct 18, 2025

☀️ Try build successful (CI)
Build commit: 7379f8a (7379f8aba17ea8f4768f69397dd41637fc4b880c, parent: c8a31b780d5415358566a20b94912620a3f27067)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7379f8a): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.5% [0.3%, 0.8%] 4
Regressions ❌
(secondary)
0.5% [0.5%, 0.6%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.3%, 0.8%] 4

Max RSS (memory usage)

Results (primary -1.0%, secondary -2.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-1.1%, -1.0%] 2
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.6%] 1
All ❌✅ (primary) -1.0% [-1.1%, -1.0%] 2

Cycles

Results (secondary -0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [2.2%, 2.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.0% [-5.4%, -2.5%] 2
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.3%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.3% [0.0%, 1.0%] 42
Regressions ❌
(secondary)
0.1% [0.1%, 0.2%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.0%, 1.0%] 42

Bootstrap: 473.714s -> 472.872s (-0.18%)
Artifact size: 390.54 MiB -> 390.71 MiB (0.04%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 18, 2025
Previously copy propagation presumed that there is further unspecified
distinction between move operands and copy operands in assignments and
propagated moves from assignments into terminators. This is inconsistent
with current operational semantics.

Turn moves into copies after copy propagation to preserve existing behavior.

Fixes rust-lang#137936.
Fixes rust-lang#146423.
@tmiasko tmiasko marked this pull request as ready for review October 18, 2025 18:06
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aliasing-related miscompile in CopyProp CopyProp miscompilation when src is moved more than once

6 participants