Don't touch UOps.DEFINE_GLOBAL (#3575)

This commit is contained in:
uuuvn 2024-03-02 13:30:05 +02:00 committed by GitHub
parent 50e1445e60
commit fb8acd1851
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -88,12 +88,14 @@ class UOpGraph:
return ret
def remove_childless(self):
UOPS_W_SIDE_EFFECTS = {UOps.DEFINE_GLOBAL, UOps.STORE}
while 1:
has_child: Set[UOp] = set()
for ru in self.uops:
for vu in ru.vin:
has_child.add(vu)
nu: List[UOp] = [x for x in self.uops if x in has_child or x.uop is UOps.STORE]
nu: List[UOp] = [x for x in self.uops if x in has_child or x.uop in UOPS_W_SIDE_EFFECTS]
if len(nu) == len(self.uops): break
if DEBUG >= 4: print(f"reduced UOp count from {len(self.uops)} to {len(nu)}")
self.uops = nu