-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
MIR pass to remove unneeded drops on types not needing drop #76673
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
1657e01
to
9c5d0c1
Compare
r? @oli-obk (the first reviewer suggested by github) |
No, we'll want inlining to take care of this at some point |
one thing I'm wondering is whether we should/could just rerun drop elaboration after inlining... That would catch even more cases, but may be expensive. |
Hi @oli-obk Note that on mir-opt-level=1 this pass really does nothing as the inliner is not running.
I suggest handling that in another issue. Do you want to elaborate on it yourself in another issue? |
yes let's handle that in the future. It was just random musing, I don't know at all whether any of that is actionable @bors r+ |
📌 Commit 804f673 has been approved by |
…r=oli-obk MIR pass to remove unneeded drops on types not needing drop This is heavily dependent on MIR inlining running to actually see the drop statement. Do we want to special case replacing a call to std::mem::drop with a goto aswell?
…r=oli-obk MIR pass to remove unneeded drops on types not needing drop This is heavily dependent on MIR inlining running to actually see the drop statement. Do we want to special case replacing a call to std::mem::drop with a goto aswell?
…r=oli-obk MIR pass to remove unneeded drops on types not needing drop This is heavily dependent on MIR inlining running to actually see the drop statement. Do we want to special case replacing a call to std::mem::drop with a goto aswell?
…r=oli-obk MIR pass to remove unneeded drops on types not needing drop This is heavily dependent on MIR inlining running to actually see the drop statement. Do we want to special case replacing a call to std::mem::drop with a goto aswell?
…r=oli-obk MIR pass to remove unneeded drops on types not needing drop This is heavily dependent on MIR inlining running to actually see the drop statement. Do we want to special case replacing a call to std::mem::drop with a goto aswell?
Rebased |
@bors r=oli-obk |
📌 Commit ff24163 has been approved by |
@bors p=15 (queue fairness) |
⌛ Testing commit ff24163 with merge 1fbc1c2c0ab3279483232bf44b400d18a3275b0e... |
💔 Test failed - checks-actions |
Hmm seems like the same error as in the rollup. When I did the rebase I also reblessed but that didn't change any files. Not sure what is wrong at this point. |
Maybe the target (wasm32-unknown-unknown) is relevant to reproduce the problem? |
Yea I'd also guess that it's related to the target, as that specific drop impl doesn't seem to have unwinding activated. Check the other mir-opt tests to see if any of them have |
Let's try again with the test ignored on wasm |
@bors r=oli-obk |
📌 Commit 05f84c6 has been approved by |
☀️ Test successful - checks-actions, checks-azure |
fn visit_terminator(&mut self, terminator: &Terminator<'tcx>, location: Location) { | ||
match terminator.kind { | ||
TerminatorKind::Drop { place, target, .. } | ||
| TerminatorKind::DropAndReplace { place, target, .. } => { |
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.
The DropAndReplace terminator should never occur in an input to this pass, since it should be removed during drop elaboration. Additionally, its semantics is to drop and assign a new value, so the transformation wouldn't be correct without additional assignment. Either way, I would just remove it from here.
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.
…as-schievink Rollup of 15 pull requests Successful merges: - rust-lang#75438 (Use adaptive SVG favicon for rustdoc like other rust sites) - rust-lang#76304 (Make delegation methods of `std::net::IpAddr` unstably const) - rust-lang#76724 (Allow a unique name to be assigned to dataflow graphviz output) - rust-lang#76978 (Documented From impls in std/sync/mpsc/mod.rs) - rust-lang#77044 (Liballoc bench vec use mem take not replace) - rust-lang#77050 (Typo fix: "satsify" -> "satisfy") - rust-lang#77074 (add array::from_ref) - rust-lang#77078 (Don't use an if guard to check equality with a constant) - rust-lang#77079 (Use `Self` in docs when possible) - rust-lang#77081 (Merge two almost identical match arms) - rust-lang#77121 (Updated html_root_url for compiler crates) - rust-lang#77136 (Suggest `const_mut_refs`, not `const_fn` for mutable references in `const fn`) - rust-lang#77160 (Suggest `const_fn_transmute`, not `const_fn`) - rust-lang#77164 (Remove workaround for deref issue that no longer exists.) - rust-lang#77165 (Followup to rust-lang#76673) Failed merges: r? `@ghost`
This is heavily dependent on MIR inlining running to actually see the drop statement.
Do we want to special case replacing a call to std::mem::drop with a goto aswell?