about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-22 20:28:16 +0000
committerbors <bors@rust-lang.org>2022-08-22 20:28:16 +0000
commit015a824f2dffe32707fceb59c47effaf7b73486c (patch)
treebca90cb84654faf55a53a08b4b139cd9e12b0342 /compiler/rustc_codegen_gcc
parenta7851767419e56280110fe2859bbc15d5cbdd468 (diff)
parent18bfcd374fac5e65a9559771cbbb800d53b8549d (diff)
downloadrust-015a824f2dffe32707fceb59c47effaf7b73486c.tar.gz
rust-015a824f2dffe32707fceb59c47effaf7b73486c.zip
Auto merge of #99762 - Nilstrieb:unreachable-prop, r=oli-obk
UnreachableProp: Preserve unreachable branches for multiple targets

Before, UnreachablePropagation removed all unreachable branches. This was a pessimization, as it removed information about reachability that was used later in the optimization pipeline.

For example, this code
```rust
pub enum Two { A, B }
pub fn identity(x: Two) -> Two {
    match x {
        Two::A => Two::A,
        Two::B => Two::B,
    }
}
```

basically has `switchInt() -> [0: 0, 1: 1, otherwise: unreachable]` for the match. This allows it to be transformed into a simple `x`. If we remove the unreachable branch, the transformation becomes illegal.

This was the problem keeping `UnreachablePropagation` from being enabled, so we can enable it now.

Something similar already happened in #77800, but it did not show a perf improvement there. Let's try it again anyways!

Fixes #68105, although that issue has been fixed for a long time (see #77680).
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions