diff options
| author | bors <bors@rust-lang.org> | 2019-11-22 00:16:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-11-22 00:16:40 +0000 |
| commit | abd69551bf8b8755b5e00d4f4d45ae5d4a0cd17d (patch) | |
| tree | 6cd22524b2a19f2abff2c9aedba0c086411b1644 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | f11759d38c70d3df67135f88a682701c1cf9762a (diff) | |
| parent | 2f00e86cb5cbb4d4cfe17abc6136aacadbe02382 (diff) | |
| download | rust-abd69551bf8b8755b5e00d4f4d45ae5d4a0cd17d.tar.gz rust-abd69551bf8b8755b5e00d4f4d45ae5d4a0cd17d.zip | |
Auto merge of #66282 - Centril:simplify-try, r=oli-obk
[mir-opt] asking `?`s in a more optimized fashion
This PR works towards https://github.com/rust-lang/rust/issues/66234 by providing two optimization passes meant to run in sequence:
- `SimplifyArmIdentity` which transforms something like:
```rust
_LOCAL_TMP = ((_LOCAL_1 as Variant ).FIELD: TY );
((_LOCAL_0 as Variant).FIELD: TY) = move _LOCAL_TMP;
discriminant(_LOCAL_0) = VAR_IDX;
```
into:
```rust
_LOCAL_0 = move _LOCAL_1
```
- `SimplifyBranchSame` which transforms `SwitchInt`s to identical basic blocks into a `goto` to the first reachable target.
Together, these are meant to simplify the following into just `res`:
```rust
match res {
Ok(x) => Ok(x),
Err(x) => Err(x),
}
```
It should be noted however that the desugaring of `?` includes a function call and so the first pass in this PR relies on inlining to substitute that function call for identity on `x`. Inlining requires `mir-opt-level=2` so this might not have any effect in perf-bot but let's find out.
r? @oli-obk -- This is WIP, but I'd appreciate feedback. :)
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
