about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-07-26 15:11:12 +0200
committerNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2022-08-21 21:15:28 +0200
commiteafab660964bcd1e2c8b19cc2021cc5c7fee6c38 (patch)
tree9a536e2b4f06a87280239be011c7325ff5b055c4 /compiler/rustc_codegen_gcc
parent650bff80a623e17675ac72ae4d62ed200a4a3568 (diff)
downloadrust-eafab660964bcd1e2c8b19cc2021cc5c7fee6c38.tar.gz
rust-eafab660964bcd1e2c8b19cc2021cc5c7fee6c38.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions