about summary refs log tree commit diff
path: root/compiler/rustc_driver_impl/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-05 21:32:30 +0200
committerGitHub <noreply@github.com>2025-05-05 21:32:30 +0200
commitab7623e93c9a063e4025b72a7aefc4362f790f96 (patch)
treedee034175698ac3647381e3398efa77775e60108 /compiler/rustc_driver_impl/src
parent677a5aca7f1e201b0168a8efbb77ca2e9ac700ea (diff)
parent5881b7c68b353c3723133c43f209802b3a0c9621 (diff)
downloadrust-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