about summary refs log tree commit diff
path: root/src/test/mir-opt/inline
AgeCommit message (Collapse)AuthorLines
2021-09-30Auto merge of #89110 - Aaron1011:adjustment-span, r=estebankbors-18/+18
Use larger span for adjustment THIR expressions Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions. These spans are recoded when we first create the adjustment during typecheck. For example, an autoref adjustment triggered by a method call will record the span of the entire method call. The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-25Use larger span for adjustments on method callsAaron Hill-18/+18
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-25Bless testsGary Guo-46/+74
2021-09-18./x.py test --blessTomasz Miąsko-1/+1
2021-09-01Fix drop handling for `if let` expressionsMatthew Jasper-1/+1
MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables.
2021-08-26update mir diffslcnr-2/+2
2021-07-06Revert "Revert "Update mir opt tests""bjorn3-2/+2
This reverts commit 8d5fb5bf7d5c63dcfaea381e00ded67c21fab3a3.
2021-06-12Pretty print generator witness only in `-Zverbose` modeTomasz Miąsko-8/+8
In release build of deeply-nested-async benchmark the size of `no-opt.bc` file is reduced from 46MB to 62kB.
2021-06-07Revert "Update mir opt tests"bjorn3-2/+2
This reverts commit e0e0cfa6492292d0b905b07a4ed727f4e1aefc80.
2021-05-30Update mir opt testsbjorn3-2/+2
2021-05-17mir-opt bless for Size field being removed from AllocationRalf Jung-6/+6
2021-03-31Make unevaluated DefId rendering deterministicOli Scherer-2/+2
2021-03-23Auto merge of #83177 - erikdesjardins:zstassign, r=oli-obkbors-1/+0
Remove assignments to ZST places instead of marking ZST return place as unused partially reverts #83118 requested by `@tmiasko` in https://github.com/rust-lang/rust/pull/83118#issuecomment-799692574 r? `@oli-obk`
2021-03-20bless mir-opt testslcnr-4/+4
2021-03-17Auto merge of #82122 - bstrie:dep4real, r=dtolnaybors-5/+5
Deprecate `intrinsics::drop_in_place` and `collections::Bound`, which accidentally weren't deprecated Fixes #82080. I've taken the liberty of updating the `since` values to 1.52, since an unobservable deprecation isn't much of a deprecation (even the detailed release notes never bothered to mention these deprecations). As mentioned in the issue I'm *pretty* sure that using a type alias for `Bound` is semantically equivalent to the re-export; [the reference implies](https://doc.rust-lang.org/reference/items/type-aliases.html) that type aliases only observably differ from types when used on unit structs or tuple structs, whereas `Bound` is an enum.
2021-03-15bless testsErik Desjardins-1/+0
2021-03-13bless testsErik Desjardins-2/+0
2021-03-13Move ZST check inside UsedLocalsSimon Vandel Sillesen-0/+1
2021-03-13Extend SimplifyLocals to remove ZST writesSimon Vandel Sillesen-6/+0
2021-03-09Deprecate items that accidentally weren't deprecatedbstrie-5/+5
Fixes #82080
2021-03-06Disable destination propagation on all mir-opt-levelsTomasz Miąsko-26/+44
2021-03-05Bump mir-opt-level from 3 to 4 in testsSantiago Pastorino-2/+2
2021-02-21New pass to deduplicate blocksSimon Vandel Sillesen-1/+1
2021-02-06Rollup merge of #81753 - tmiasko:inline-instruction-set, r=oli-obkMara Bos-0/+146
Never MIR inline functions with a different instruction set
2021-02-04Revert "Avoid leaking block expression values"Felix S. Klock II-6/+5
This reverts commit 4fef39113a514bb270f5661a82fdba17d3e41dbb.
2021-02-05Never MIR inline functions with a different instruction setTomasz Miąsko-0/+146
2021-01-25Ignore a test on wasm, because that changes landing padsoli-37/+39
2021-01-23Move test to mir-opt so we actually see that no inlining is happeningoli-0/+108
2021-01-23Prevent query cycles during inliningoli-0/+69
2021-01-18Remove disabled transformation from instcombineTomasz Miąsko-1/+1
2021-01-07Reintroduce hir::ExprKind::IfCaio-13/+13
2020-12-04Avoid leaking block expression valuesMatthew Jasper-5/+6
2020-11-15Limit storage duration of inlined always live localsTomasz Miąsko-0/+9
2020-11-12./x.py test --blessTomasz Miąsko-36/+184
2020-11-12Never inline C variadic functionsTomasz Miąsko-0/+18
2020-11-12Fix generator inlining by checking for rust-call abi and spread argTomasz Miąsko-0/+16
2020-11-12Never inline when `no_sanitize` attributes differTomasz Miąsko-3/+1
The inliner looks if a sanitizer is enabled before considering `no_sanitize` attribute as possible source of incompatibility. The MIR inlining could happen in a crate with sanitizer disabled, but code generation in a crate with sanitizer enabled, thus the attribute would be incorrectly ignored. To avoid the issue never inline functions with different `no_sanitize` attributes.
2020-11-11Rollup merge of #78899 - tmiasko:inline-diverging, r=oli-obkJonas Schievink-0/+180
Support inlining diverging function calls The existing heuristic does penalize diverging calls to some degree, but since it never inlined them previously it might need some further modifications. Additionally introduce storage markers for all temporaries created by the inliner. The temporary introduced for destination rebrorrow, didn't use them previously.
2020-11-10Add flags customizing behaviour of MIR inliningTomasz Miąsko-0/+75
* `-Zinline-mir-threshold` to change the default threshold. * `-Zinline-mir-hint-threshold` to change the threshold used by functions with inline hint.
2020-11-09Support inlining diverging function callsTomasz Miąsko-0/+180
Additionally introduce storage markers for all temporaries created by the inliner. The temporary introduced for destination rebrorrow, didn't use them previously.
2020-11-09inliner: Break inlining cyclesTomasz Miąsko-0/+134
When examining candidates for inlining, reject those that are determined to be recursive either because of self-recursive calls or calls to any instances already inlined.
2020-11-06inliner: Use substs_for_mir_bodyTomasz Miąsko-0/+91
Changes from 68965 extended the kind of instances that are being inlined. For some of those, the `instance_mir` returns a MIR body that is already expressed in terms of the types found in substitution array, and doesn't need further substitution. Use `substs_for_mir_body` to take that into account.
2020-10-27Show the inline stack of MIR lints that only occur after inliningOliver Scherer-87/+87
2020-10-26Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieubors-4/+4
Support custom allocators in `Box` r? `@Amanieu` This pull request requires a crater run. ### Prior work: - #71873 - #58457 - [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate Currently blocked on: - ~#77118~ - ~https://github.com/rust-lang/chalk/issues/615 (#77515)~
2020-10-21rustc_mir: create the Integrator as soon as possible in MIR inlining.Eduard-Mihai Burtescu-52/+52
2020-10-21rustc_mir: don't throw away inlined locals' spans.Eduard-Mihai Burtescu-11/+11
2020-10-21rustc_mir: properly map scope parent chains into the caller when inlining.Eduard-Mihai Burtescu-3/+51
2020-10-21rustc_mir: track inlined callees in SourceScopeData.Eduard-Mihai Burtescu-15/+15
2020-10-07Fix mir-opt output for 32 bitTim Diekmann-2/+2
2020-10-07Support custom allocators in `Box`Tim Diekmann-2/+2
Remove `Box::leak_with_alloc` Add leak-test for box with allocator Rename `AllocErr` to `AllocError` in leak-test Add `Box::alloc` and adjust examples to use the new API