Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Optimization for the Generic Dominator Calculation Algorithm #1424

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions miasm/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,12 @@ def _compute_generic_dominators(head, reachable_cb, prev_cb, next_cb):
dominators[node] = set(nodes)

dominators[head] = set([head])
todo = set(nodes)
todo = set([n for n in next_cb(head)])

while todo:
node = todo.pop()

# Heads state must not be changed
# Head's state must not be changed
if node == head:
continue

Expand All @@ -446,6 +446,7 @@ def _compute_generic_dominators(head, reachable_cb, prev_cb, next_cb):
dominators[node] = new_dom
for succ in next_cb(node):
todo.add(succ)

return dominators

def compute_dominators(self, head):
Expand Down