Skip to content

kirin.rewrite.compactify.CFGCompactify

← Module overview

classCFGCompactifysource

kirin.rewrite.compactify.CFGCompactify

Bases: RewriteRule

Compactify the CFG by removing dead blocks and merging blocks if the statement uses the SSACFG convention. Do nothing if given `ir.Region` or `ir.Block` due to no context of the region.

class CFGCompactify

To compactify hierarchical CFG, combine this rule with kirin.rewrite.Walk to recursively apply this rule to all statements.

methodrewrite_Statementsource

kirin.rewrite.compactify.CFGCompactify.rewrite_Statement

def rewrite_Statement(node: ir.Statement) -> RewriteResult

Parameters

NameTypeDescription
nodeir.Statement

Returns

RewriteResult

source