-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop emitting drop loops for every array length
We can just unsize the array to a slice and drop that instead, reusing the same loop. As part of this (and how I originally noticed this), use `PtrMetadata` instead of `Len` for the slice length, for another step closer to being able to remove `Rvalue::Len`.
- Loading branch information
Showing
4 changed files
with
90 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...-opt/slice_drop_shim.core.ptr-drop_in_place.[String;42].AddMovesForPackedDrops.before.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// MIR for `std::ptr::drop_in_place` before AddMovesForPackedDrops | ||
|
||
fn std::ptr::drop_in_place(_1: *mut [String; 42]) -> () { | ||
let mut _0: (); | ||
let mut _2: *mut [std::string::String; 42]; | ||
let mut _3: *mut [std::string::String]; | ||
|
||
bb0: { | ||
goto -> bb3; | ||
} | ||
|
||
bb1: { | ||
return; | ||
} | ||
|
||
bb2 (cleanup): { | ||
resume; | ||
} | ||
|
||
bb3: { | ||
_2 = &raw mut (*_1); | ||
_3 = move _2 as *mut [std::string::String] (PointerCoercion(Unsize, Implicit)); | ||
drop((*_3)) -> [return: bb1, unwind: bb2]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters