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
..
2025-05-02 15:53:39 +10:00
2025-05-05 11:50:43 +00:00
2025-05-04 22:03:15 +03:00
2025-05-04 22:03:15 +03:00
2025-04-30 07:10:56 +10:00
2025-05-04 15:16:06 +00:00
2025-04-30 10:18:26 +02:00
2025-04-30 17:27:57 +02:00
2025-05-04 22:03:15 +03:00
2025-05-04 22:03:15 +03:00
2025-05-04 22:03:15 +03:00
2025-05-05 11:50:43 +00:00
2025-05-01 16:04:19 +00:00
2025-05-04 22:03:15 +03:00
2025-05-02 15:59:38 +03:00
2025-05-04 21:44:50 +08:00
2025-05-04 22:03:15 +03:00
2025-05-05 11:50:43 +00:00
2025-05-05 11:50:43 +00:00
2025-05-03 12:46:51 +10:00
2025-04-30 22:36:41 +02:00
2025-05-01 20:05:02 +01:00
2025-05-04 22:03:15 +03:00
2025-05-02 17:35:50 +00:00
2025-04-26 14:08:58 -07:00
2025-05-01 17:59:00 +00:00
2025-05-03 10:18:50 -07:00
2025-04-29 20:48:51 +10:00
2025-05-04 22:03:15 +03:00
2025-05-05 11:50:43 +00:00
2025-05-04 22:03:15 +03:00
2025-04-28 16:23:13 +07:00
2025-05-05 21:32:30 +02:00
2025-04-29 11:47:37 +02:00
2025-05-01 20:05:02 +01:00
2025-05-04 21:44:50 +08:00
2025-05-03 22:39:43 +08:00
2025-05-04 22:03:15 +03:00
2025-04-28 13:30:45 +02:00
2025-05-01 04:11:52 +00:00
2025-04-29 12:04:33 +02:00
2025-05-05 11:50:43 +00:00
2025-05-02 13:36:55 +02:00
2025-05-04 22:03:15 +03:00
2025-04-29 12:28:22 -04:00
2025-05-04 22:03:15 +03:00
2025-05-05 11:50:43 +00:00
2025-05-04 13:21:07 +10:00
2025-05-05 00:20:57 -04:00
2025-05-01 20:05:02 +01:00
2025-05-02 19:37:56 +02:00
2025-05-05 11:50:43 +00:00
2025-05-01 20:05:02 +01:00