Skip to content

Commit

Permalink
Improve name hints
Browse files Browse the repository at this point in the history
  • Loading branch information
alexarice committed Dec 14, 2024
1 parent da889d4 commit 5a3a9f7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions inconspiquous/transforms/xzs/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
RewritePattern,
op_type_rewrite_pattern,
)
from xdsl.rewriter import InsertPoint
from inconspiquous.dialects.gate import XZSOp
from inconspiquous.dialects.qssa import DynGateOp

Expand Down Expand Up @@ -39,17 +40,21 @@ def match_and_rewrite(self, op: DynGateOp, rewriter: PatternRewriter):
new_phase = AddiOp(gate1.phase, gate2.phase)
new_gate = XZSOp(new_x, new_z, new_phase)

rewriter.replace_matched_op(
new_gate.out.name_hint = gate1.out.name_hint

rewriter.insert_op(
(
new_x,
new_z_and,
new_z_add,
new_z,
new_phase,
new_gate,
DynGateOp(new_gate, *predecessor.ins),
)
),
InsertPoint.after(gate2),
)

rewriter.replace_matched_op(DynGateOp(new_gate, *predecessor.ins))
rewriter.erase_op(predecessor)


Expand Down

0 comments on commit 5a3a9f7

Please sign in to comment.