Skip to content

Commit 8db9b3a

Browse files
committed
Fix conversion of XOp
1 parent 045570c commit 8db9b3a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

mlir/lib/Conversion/QCToJeff/QCToJeff.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,17 @@ struct ConvertQCXOpToJeff final : StatefulOpConversionPattern<qc::XOp> {
101101
auto qcQubit = op.getQubitIn();
102102

103103
auto jeffQubit = qubitMap[qcQubit];
104-
auto jeffOp = rewriter.replaceOpWithNewOp<jeff::XOp>(
105-
op, jeffQubit, /*in_ctrl_qubits=*/ValueRange{}, /*num_ctrls=*/0,
106-
/*is_adjoint=*/false,
107-
/*power=*/1);
104+
auto jeffOp = rewriter.create<jeff::XOp>(op.getLoc(), jeffQubit,
105+
/*in_ctrl_qubits=*/ValueRange{},
106+
/*num_ctrls=*/0,
107+
/*is_adjoint=*/false,
108+
/*power=*/1);
108109

109110
// Update qubit map
110111
qubitMap[qcQubit] = jeffOp.getOutQubit();
111112

113+
rewriter.eraseOp(op);
114+
112115
return success();
113116
}
114117
};

0 commit comments

Comments
 (0)