@@ -795,9 +795,7 @@ impl<'a, F: Function> Env<'a, F> {
795
795
let mut last_inst: Option < Inst > = None ;
796
796
let mut last_vreg: Option < VRegIndex > = None ;
797
797
798
- for entry_idx in 0 ..self . bundles [ bundle. index ( ) ] . ranges . len ( ) {
799
- // Iterate manually; don't borrow `self`.
800
- let entry = self . bundles [ bundle. index ( ) ] . ranges [ entry_idx] ;
798
+ for entry in core:: mem:: take ( & mut self . bundles [ bundle. index ( ) ] . ranges ) {
801
799
let lr_from = entry. range . from ;
802
800
let lr_to = entry. range . to ;
803
801
@@ -807,8 +805,7 @@ impl<'a, F: Function> Env<'a, F> {
807
805
trace ! ( " -> removing old LR {:?} for vreg {:?}" , entry. index, vreg) ;
808
806
809
807
let mut last_live_pos = entry. range . from ;
810
- for use_idx in 0 ..self . ranges [ entry. index . index ( ) ] . uses . len ( ) {
811
- let u = self . ranges [ entry. index . index ( ) ] . uses [ use_idx] ;
808
+ for u in core:: mem:: take ( & mut self . ranges [ entry. index . index ( ) ] . uses ) {
812
809
trace ! ( " -> use {:?} (last_live_pos {:?})" , u, last_live_pos) ;
813
810
814
811
// If we just created a LR for this inst at the last
@@ -930,9 +927,6 @@ impl<'a, F: Function> Env<'a, F> {
930
927
last_vreg = Some ( vreg) ;
931
928
}
932
929
933
- // Clear the use-list from the original LR.
934
- self . ranges [ entry. index . index ( ) ] . uses = Default :: default ( ) ;
935
-
936
930
// If there is space from the last use to the end of the
937
931
// LR, put that in the spill bundle too.
938
932
if entry. range . to > last_live_pos {
@@ -958,10 +952,6 @@ impl<'a, F: Function> Env<'a, F> {
958
952
}
959
953
}
960
954
961
- // Clear the LR list in the original bundle.
962
- self . bundles [ bundle. index ( ) ] . ranges . clear ( ) ;
963
- self . bundles [ bundle. index ( ) ] . ranges . shrink_to_fit ( ) ;
964
-
965
955
// Remove all of the removed LRs from respective vregs' lists.
966
956
for vreg in removed_lrs_vregs {
967
957
self . vregs [ vreg. index ( ) ]
0 commit comments