Skip to content

Remove empty arg gates

RemoveEmptyArgGates dataclass

RemoveEmptyArgGates()

Bases: Pass


              flowchart TD
              bloqade.rewrite.passes.remove_empty_arg_gates.RemoveEmptyArgGates[RemoveEmptyArgGates]

              

              click bloqade.rewrite.passes.remove_empty_arg_gates.RemoveEmptyArgGates href "" "bloqade.rewrite.passes.remove_empty_arg_gates.RemoveEmptyArgGates"
            

Remove squin statements that act on compile-time-empty qubit lists.

unsafe_run

unsafe_run(mt: Method) -> RewriteResult

Remove empty-arg quantum ops across the method call graph.

Source code in .venv/lib/python3.12/site-packages/bloqade/rewrite/passes/remove_empty_arg_gates.py
15
16
17
18
19
20
21
22
23
def unsafe_run(self, mt: ir.Method) -> RewriteResult:
    """Remove empty-arg quantum ops across the method call graph."""
    return CallGraphPass(
        dialects=self.dialects,
        no_raise=self.no_raise,
        rule_factory=lambda callee, call_graph: Walk(
            RemoveEmptyArgOps(call_graph=call_graph, callee=callee)
        ),
    )(mt)