rust/compiler/rustc_mir_transform
Guillaume Gomez ab7623e93c
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
2025-05-05 21:32:30 +02:00
..
src Rollup merge of #140115 - dianqk:gvn-matchbr, r=oli-obk 2025-05-05 21:32:30 +02:00
Cargo.toml Stop relying on rustc_type_ir in non-type-system crates 2025-03-15 06:42:48 +00:00
messages.ftl Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etc 2025-04-24 13:14:36 +07:00