diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2020-05-11 20:13:15 -0400 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2020-05-11 20:31:02 -0400 |
| commit | 6de6d70ae0a21b779d63d885438c7214e17e7a6d (patch) | |
| tree | 22ba33d1fe91aad2e4b62faf677f67b5f45c6e82 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 99cb9ccb9ca2067ad6e60508e3d52da77396b2f1 (diff) | |
| download | rust-6de6d70ae0a21b779d63d885438c7214e17e7a6d.tar.gz rust-6de6d70ae0a21b779d63d885438c7214e17e7a6d.zip | |
Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1
I also added test cases to make sure the optimization can fire on all of
these cases:
```rust
fn case_1(o: Option<u8>) -> Option<u8> {
match o {
Some(u) => Some(u),
None => None,
}
}
fn case2(r: Result<u8, i32>) -> Result<u8, i32> {
match r {
Ok(u) => Ok(u),
Err(i) => Err(i),
}
}
fn case3(r: Result<u8, i32>) -> Result<u8, i32> {
let u = r?;
Ok(u)
}
```
Without MIR inlining, this still does not completely optimize away the
`?` operator because the `Try::into_result()`, `From::from()` and
`Try::from_error()` calls still exist. This does move us a bit closer to
that goal though because:
- We can now run the pass on mir-opt-level=1
- We no longer depend on the copy propagation pass running which is
unlikely to stabilize anytime soon.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
