diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-05-05 21:32:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-05 21:32:30 +0200 |
| commit | ab7623e93c9a063e4025b72a7aefc4362f790f96 (patch) | |
| tree | dee034175698ac3647381e3398efa77775e60108 /compiler/rustc_driver_impl/src | |
| parent | 677a5aca7f1e201b0168a8efbb77ca2e9ac700ea (diff) | |
| parent | 5881b7c68b353c3723133c43f209802b3a0c9621 (diff) | |
| download | rust-ab7623e93c9a063e4025b72a7aefc4362f790f96.tar.gz rust-ab7623e93c9a063e4025b72a7aefc4362f790f96.zip | |
Rollup merge of #140115 - dianqk:gvn-matchbr, r=oli-obk
mir-opt: execute MatchBranchSimplification after GVN
This can provide more opportunities for MatchBranchSimplification.
Currently, rustc does not optimize the following code into a single statement at mir-opt, and this PR fixes the first case.
```rust
pub fn match1(c: bool, v1: i32, v2: i32) -> i32 {
if c { v1 - v2 } else { v1 - v2 }
}
pub fn match2(c: bool, v1: i32) -> i32 {
if c { v1 - 1 } else { v1 - 1 }
}
```
https://rust.godbolt.org/z/Y8xPMjrfM
r? mir-opt
Diffstat (limited to 'compiler/rustc_driver_impl/src')
0 files changed, 0 insertions, 0 deletions
