Fix complexity bug in allocation.

This commit is contained in:
Marcel Keller
2023-02-06 18:01:07 +11:00
parent 07a5b1fa63
commit 25c49abcf1
2 changed files with 5 additions and 1 deletions

View File

@@ -101,6 +101,7 @@ class StraightlineAllocator:
self.dealloc |= reg.vector
else:
self.dealloc.add(reg)
reg.duplicates.remove(reg)
base = reg.vectorbase
seen = set_by_id()
@@ -171,7 +172,7 @@ class StraightlineAllocator:
for reg in self.alloc:
for x in reg.get_all():
if x not in self.dealloc and reg not in self.dealloc \
and len(x.duplicates) == 1:
and len(x.duplicates) == 0:
print('Warning: read before write at register', x)
print('\tregister trace: %s' % format_trace(x.caller,
'\t\t'))

View File

@@ -265,6 +265,9 @@ class set_by_id(object):
def pop(self):
return self.content.popitem()[1]
def remove(self, value):
del self.content[id(value)]
def __ior__(self, values):
for value in values:
self.add(value)