-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Allow MIR-inlining Drop
terminators too
#144561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
let source_info = terminator.source_info; | ||
let drop_ty = place.ty(&caller_body.local_decls, tcx).ty; | ||
if !drop_ty.needs_drop(tcx, inliner.typing_env()) { | ||
//return None; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: fix
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #144543) made this pull request unmergeable. Please resolve the merge conflicts. |
You'll probably need to change the mir shim pass. The current implementation only reliably supports monomorphic types. |
Simplify `align_of_val::<[T]>(…)` → `align_of::<T>()` I spotted this while working on the inliner (rust-lang#144561). In particular, if [`Layout::for_value`](https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.for_value) inlines, then it can be pretty easy to end up with an `align_of_val::<[T]>` today (demo: <https://rust.godbolt.org/z/Tesnscj4a>) where we can save at least a block, if not more, by using the version that's an rvalue and not a call.
Rollup merge of #144566 - scottmcm:align-of-slice, r=oli-obk Simplify `align_of_val::<[T]>(…)` → `align_of::<T>()` I spotted this while working on the inliner (#144561). In particular, if [`Layout::for_value`](https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.for_value) inlines, then it can be pretty easy to end up with an `align_of_val::<[T]>` today (demo: <https://rust.godbolt.org/z/Tesnscj4a>) where we can save at least a block, if not more, by using the version that's an rvalue and not a call.
Hmm, looks like you're right. Just trying to guard requesting the mir doesn't work since it's a concrete outer type, just with field issues. Tricky; I'll have to spend some time grokking the shim pass. |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Fortify RemoveUnneededDrops test. Test tweak that is useful in preparation for rust-lang#144561
Fortify RemoveUnneededDrops test. Test tweak that is useful in preparation for rust-lang#144561
Fortify RemoveUnneededDrops test. Test tweak that is useful in preparation for rust-lang#144561
We've already been able to do this if
drop(_1)
was spelled_2 = &raw mut _1; drop_in_place(move _2)
, so this just needs to do the necessary updates to the query-cycle-avoidance check and to look forDrop
s in the normal (non-force) inliner.This tries to avoid turning
drop
s intodrop_in_place
calls if they're likely not going to be inlined, since theCall
needs an extra local and an extra statement.r? cjgillot