You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def natural_loops(target: Function) -> int:
return sum([bb in bb.dominance_frontier for bb in target.basic_blocks])
The len() function will then return the length of this list, which is the number of basic blocks in target.basic_blocks, not the number of natural loops.
If you want to count the number of basic blocks that exist within their own dominance bounds (actually the number of natural loops), then you should use sum() instead of len().
The text was updated successfully, but these errors were encountered:
def natural_loops(target: Function) -> int:
return sum([bb in bb.dominance_frontier for bb in target.basic_blocks])
The len() function will then return the length of this list, which is the number of basic blocks in target.basic_blocks, not the number of natural loops.
If you want to count the number of basic blocks that exist within their own dominance bounds (actually the number of natural loops), then you should use sum() instead of len().
The text was updated successfully, but these errors were encountered: