File tree 2 files changed +5
-4
lines changed 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -754,7 +754,8 @@ func (a *Allocator) allocBlock(f Function, blk Block) {
754
754
killSet := a .reals [:0 ]
755
755
756
756
// Gather the set of registers that will be used in the current instruction.
757
- for _ , use := range instr .Uses (& a .vs ) {
757
+ uses := instr .Uses (& a .vs )
758
+ for _ , use := range uses {
758
759
if use .IsRealReg () {
759
760
r := use .RealReg ()
760
761
currentUsedSet = currentUsedSet .add (r )
@@ -769,7 +770,7 @@ func (a *Allocator) allocBlock(f Function, blk Block) {
769
770
}
770
771
}
771
772
772
- for i , use := range instr . Uses ( & a . vs ) {
773
+ for i , use := range uses {
773
774
if ! use .IsRealReg () {
774
775
vs := s .getVRegState (use .ID ())
775
776
killed := vs .lastUse == pc
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ type IDedPool[T any] struct {
69
69
70
70
// NewIDedPool returns a new IDedPool.
71
71
func NewIDedPool [T any ](resetFn func (* T )) IDedPool [T ] {
72
- return IDedPool [T ]{pool : NewPool [T ](resetFn )}
72
+ return IDedPool [T ]{pool : NewPool [T ](resetFn ), maxIDEncountered : - 1 }
73
73
}
74
74
75
75
// GetOrAllocate returns the T with the given id.
@@ -97,7 +97,7 @@ func (p *IDedPool[T]) Get(id int) *T {
97
97
// Reset resets the pool.
98
98
func (p * IDedPool [T ]) Reset () {
99
99
p .pool .Reset ()
100
- for i := range p . idToItems {
100
+ for i := 0 ; i <= p . maxIDEncountered ; i ++ {
101
101
p .idToItems [i ] = nil
102
102
}
103
103
p .maxIDEncountered = - 1
You can’t perform that action at this time.
0 commit comments