@@ -795,9 +795,7 @@ impl<'a, F: Function> Env<'a, F> {
795795 let mut last_inst: Option < Inst > = None ;
796796 let mut last_vreg: Option < VRegIndex > = None ;
797797
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 ) {
801799 let lr_from = entry. range . from ;
802800 let lr_to = entry. range . to ;
803801
@@ -807,8 +805,7 @@ impl<'a, F: Function> Env<'a, F> {
807805 trace ! ( " -> removing old LR {:?} for vreg {:?}" , entry. index, vreg) ;
808806
809807 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 ) {
812809 trace ! ( " -> use {:?} (last_live_pos {:?})" , u, last_live_pos) ;
813810
814811 // If we just created a LR for this inst at the last
@@ -930,9 +927,6 @@ impl<'a, F: Function> Env<'a, F> {
930927 last_vreg = Some ( vreg) ;
931928 }
932929
933- // Clear the use-list from the original LR.
934- self . ranges [ entry. index . index ( ) ] . uses = Default :: default ( ) ;
935-
936930 // If there is space from the last use to the end of the
937931 // LR, put that in the spill bundle too.
938932 if entry. range . to > last_live_pos {
@@ -958,10 +952,6 @@ impl<'a, F: Function> Env<'a, F> {
958952 }
959953 }
960954
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-
965955 // Remove all of the removed LRs from respective vregs' lists.
966956 for vreg in removed_lrs_vregs {
967957 self . vregs [ vreg. index ( ) ]
0 commit comments