Always use a DropTree to build drops#159537
Conversation
And some more cases along the way. We have a specific optimization to avoid generating useless drops, use it. In particular, aggregate construction are very similar to function calls for which this is designed.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Always use a `DropTree` to build drops
|
The job Click to see the possible cause of the failure (guessed by this bot) |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (21c512d): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -1.5%, secondary 2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 4.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.3%, secondary -0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 489.126s -> 486.369s (-0.56%) |
MIR building currently has 2 ways to build drops.
A normal exit from a scope uses
leave_top_scopes, which callsbuild_scope_drops. That method generates a compact sequence ofStorageDeadstatements andDropterminators.For anormal exits (
else,break,continue,return, unwind and coroutine drop), we use aDropTreewhich is a much more flexible structure in which we record blocks as entry points.In order to work correctly,
build_scope_dropsassumes a lot about the structure of theDropTree. This forbids us from unscheduling drops for moved-from locals. This PR removes it altogether, to always use the more flexibleDropTree. The generated MIR should be equivalent, but more verbose.r? @ghost for perf, and because of a borrowck corner case