Simplify the canonical enum clone branches to a copy statement#148034
Simplify the canonical enum clone branches to a copy statement#148034rust-bors[bot] merged 4 commits intorust-lang:mainfrom
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[WIP] Simplify the canonical enum clone branches to a copy statement
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
💔 Test for b4269e3 failed: CI. Failed jobs:
|
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[WIP] Simplify the canonical enum clone branches to a copy statement
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (673e3f6): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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 @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.4%, secondary -2.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%, secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 476.496s -> 474.095s (-0.50%) |
d2deaa3 to
8a2e9e4
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Simplify the canonical enum clone branches to a copy statement
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (5f821fd): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking 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 @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -3.6%, secondary 5.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (primary -0.1%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 480.798s -> 481.457s (0.14%) |
|
From the several results, it appears regex-automata-0.4.8 is flaky. @rustbot review |
|
@bors r+ |
|
@bors p=2 |
This comment has been minimized.
This comment has been minimized.
Simplify the canonical enum clone branches to a copy statement
I have overhauled MatchBranchSimplification in this PR. This pass tries to unify statements one by one, which is more readable and extensible.
This PR also unifies the following pattern that is mostly generated by GVN into one basic block that contains the copy statement:
```rust
match a {
Foo::A(_) => *a,
Foo::B => Foo::B
}
```
Fixes #128081.
|
@bors yield |
|
Auto build cancelled. Cancelled workflows: The next pull request likely to be tested is #152825. |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing fbd6934 (parent) -> 41198cb (this PR) Test differencesShow 30 test diffsStage 1
Stage 2
Additionally, 26 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 41198cb9659f3cc7c4a1a3ee97bc4af78bee403e --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (41198cb): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.2%, secondary 9.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 481.318s -> 479.676s (-0.34%) |
…on-flag-check, r=clubby789,jieyouxu Improve runtest revision redundant cfg check While attempting to ingest rust-lang#148034 via ferrocene/ferrocene#2172 we noticed a test failure, as we add some `compile_flags` to tests. We saw a failure looking like this: ``` Testing stage1 with compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu) running 2 tests 2026-02-20T20:21:28.846102Z ERROR compiletest::runtest: redundant cfg argument `copy` is already created by the revision [mir-opt] tests/mir-opt/pre-codegen/copy_and_clone.rs#COPY ... F . ``` While my Rust checkout passed: ``` Testing stage1 with compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu) running 2 tests .. test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 381 filtered out; finished in 107.10ms ``` This caused me to add some debugging statements. Ferrocene: ``` 2026-02-20T21:05:39.808427Z ERROR compiletest::runtest: "copy": does ["--edition=2015", "--cfg=copy"] contain `"--cfg=copy"` or `["--cfg", "copy"]`? true 2026-02-20T21:05:39.808427Z ERROR compiletest::runtest: "clone": does ["--edition=2015"] contain `"--cfg=clone"` or `["--cfg", "clone"]`? false 2026-02-20T21:05:39.808435Z ERROR compiletest::runtest: redundant cfg argument `copy` is already created by the revision ``` Rust: ``` 2026-02-20T21:04:18.493158Z ERROR compiletest::runtest: "copy": does ["--cfg=copy"] contain `"--cfg=copy"` or `["--cfg", "copy"]`? false 2026-02-20T21:04:18.493158Z ERROR compiletest::runtest: "clone": does [] contain `"--cfg=clone"` or `["--cfg", "clone"]`? false ``` I noticed while reviewing the related functionality that there is a call to `.windows(2)` in the relevant check for redundant cfgs: https://github.com/rust-lang/rust/blob/0376d43d443cba463a0b6a6ec9140ea17d7b7130/src/tools/compiletest/src/runtest.rs#L507-L511 Noting: https://github.com/rust-lang/rust/blob/0376d43d443cba463a0b6a6ec9140ea17d7b7130/library/core/src/slice/mod.rs#L1064-L1066 Because of this, the revision check was getting an empty iterator when `self.props.compile_flags` was length 0 or 1. This fix adjusts the check to handle such cases. I went ahead and fixed the relevant test (4b3cd9b) that was impacted by this. I do not suspect there are others, at least within the scope that Ferrocene tests, as we have not previously seen this failure.
…on-flag-check, r=clubby789,jieyouxu Improve runtest revision redundant cfg check While attempting to ingest rust-lang#148034 via ferrocene/ferrocene#2172 we noticed a test failure, as we add some `compile_flags` to tests. We saw a failure looking like this: ``` Testing stage1 with compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu) running 2 tests 2026-02-20T20:21:28.846102Z ERROR compiletest::runtest: redundant cfg argument `copy` is already created by the revision [mir-opt] tests/mir-opt/pre-codegen/copy_and_clone.rs#COPY ... F . ``` While my Rust checkout passed: ``` Testing stage1 with compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu) running 2 tests .. test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 381 filtered out; finished in 107.10ms ``` This caused me to add some debugging statements. Ferrocene: ``` 2026-02-20T21:05:39.808427Z ERROR compiletest::runtest: "copy": does ["--edition=2015", "--cfg=copy"] contain `"--cfg=copy"` or `["--cfg", "copy"]`? true 2026-02-20T21:05:39.808427Z ERROR compiletest::runtest: "clone": does ["--edition=2015"] contain `"--cfg=clone"` or `["--cfg", "clone"]`? false 2026-02-20T21:05:39.808435Z ERROR compiletest::runtest: redundant cfg argument `copy` is already created by the revision ``` Rust: ``` 2026-02-20T21:04:18.493158Z ERROR compiletest::runtest: "copy": does ["--cfg=copy"] contain `"--cfg=copy"` or `["--cfg", "copy"]`? false 2026-02-20T21:04:18.493158Z ERROR compiletest::runtest: "clone": does [] contain `"--cfg=clone"` or `["--cfg", "clone"]`? false ``` I noticed while reviewing the related functionality that there is a call to `.windows(2)` in the relevant check for redundant cfgs: https://github.com/rust-lang/rust/blob/0376d43d443cba463a0b6a6ec9140ea17d7b7130/src/tools/compiletest/src/runtest.rs#L507-L511 Noting: https://github.com/rust-lang/rust/blob/0376d43d443cba463a0b6a6ec9140ea17d7b7130/library/core/src/slice/mod.rs#L1064-L1066 Because of this, the revision check was getting an empty iterator when `self.props.compile_flags` was length 0 or 1. This fix adjusts the check to handle such cases. I went ahead and fixed the relevant test (4b3cd9b) that was impacted by this. I do not suspect there are others, at least within the scope that Ferrocene tests, as we have not previously seen this failure.
I have overhauled MatchBranchSimplification in this PR. This pass tries to unify statements one by one, which is more readable and extensible.
This PR also unifies the following pattern that is mostly generated by GVN into one basic block that contains the copy statement:
Fixes #128081.