mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-19 19:17:31 +00:00
![]() 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 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |