Commit 41198cb
committed
Auto merge of #148034 - dianqk:matchbr-copy, r=cjgillot
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.19 files changed
Lines changed: 1053 additions & 490 deletions
File tree
- compiler/rustc_mir_transform/src
- tests
- codegen-llvm/issues
- mir-opt
- inline
- pre-codegen
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
0 commit comments