You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
0 commit comments