Skip to content

Commit

Permalink
simplify cfg calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Oct 26, 2024
1 parent d1951a0 commit d1e18d6
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions vyper/venom/analysis/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ def analyze(self) -> None:
for bb in fn.get_basic_blocks():
assert bb.is_terminated

for inst in bb.instructions:
if inst.opcode in CFG_ALTERING_INSTRUCTIONS:
ops = inst.get_label_operands()
for op in ops:
fn.get_basic_block(op.value).add_cfg_in(bb)

# Fill in the "out" set for each basic block
for bb in fn.get_basic_blocks():
for in_bb in bb.cfg_in:
in_bb.add_cfg_out(bb)
term = bb.instructions[-1]
if term.opcode in CFG_ALTERING_INSTRUCTIONS:
ops = term.get_label_operands()
for op in ops:
next_bb = fn.get_basic_block(op.value)
next_bb.add_cfg_in(bb)
bb.add_cfg_out(next_bb)

def _compute_dfs_r(self, bb, visited=None):
assert self._dfs is not None # help mypy
Expand Down

0 comments on commit d1e18d6

Please sign in to comment.