about summary refs log tree commit diff
path: root/src/librustc_mir/transform/simplify_try.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-765/+0
2020-08-16Implement 'considered equal' for statements, so that for example `_0 = _1` ↵Simon Vandel Sillesen-36/+223
and `discriminant(_0) = discriminant(0)` are considered equal if 0 is a fieldless variant of an enum
2020-08-14Rm allocation in uninhabited_enum_branchingkadmin-22/+21
Also convert `uninhabited_enum_branching` `Cow<[u128]>::to_mut`
2020-08-08fix clippy::needless_return: remove unneeded return statementsMatthias Krüger-1/+1
2020-07-02Fix missing return in `optimization_applies()`Wesley Wiser-0/+1
2020-07-02Fix debuginfo so that it points to the correct localWesley Wiser-10/+59
2020-07-02[mir-opt] Prevent mis-optimization when SimplifyArmIdentity runsWesley Wiser-2/+49
If temporaries are used beyond just the temporary chain, then we can't optimize out the reads and writes.
2020-06-12Disable the `SimplifyArmIdentity` pass on betaWesley Wiser-1/+5
This pass is buggy so I'm disabling it to fix a stable-to-beta regression. Related to #73223
2020-06-09Fix more clippy warningsMatthias Krüger-2/+2
Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next
2020-05-11Modify SimplifyArmIdentity so it can trigger on mir-opt-level=1Wesley Wiser-39/+313
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.
2020-04-22Use `Body` everywhereDylan MacKenzie-2/+2
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-1/+1
2020-03-31Use Place directly, it's Copy even more use casesSantiago Pastorino-3/+3
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-2/+2
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-1/+1
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-02-11simplify_try: address some of eddyb's commentsMazdak Farrokhzad-0/+3
2020-01-28Local field on PlaceRef and RootPlace is not a reference anymoreSantiago Pastorino-1/+1
2020-01-10Remove PlaceBase enum and make Place base field be local: LocalSantiago Pastorino-2/+2
2019-12-22Format the worldMark Rousskov-17/+11
2019-12-05rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded ↵Paul Daniel Faria-2/+2
Index impl, remove body fn rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-02Fix rebasing errors, convert some BodyCache::body() calls to reborrowsPaul Daniel Faria-2/+2
2019-11-29SimplifyArmIdentity only for locals with the same typeTomasz Miąsko-1/+7
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-21Introduce MIR optimizations for simplifying `x?` on `Result`s.Mazdak Farrokhzad-0/+201
This optimization depends on inlining for the identity conversions introduced by the lowering of the `?`. To take advantage of `SimplifyArmIdentity`, `-Z mir-opt-level=2` is required because that triggers the inlining MIR optimization.