Description
#1751 has dropped the condition that modifier bodies can only contain a single unitary operation followed by a yield operation.
We should add a canonicalization that pulls out GPhaseOps from multi-operation ctrl modifiers. For example,
%const = arith.constant 0.123 : f64
qc.ctrl(%c0, %c1) targets(%t0, %t1) {
qc.gphase(%const)
qc.rxx(%const) %t0, %t1 : !qc.qubit, !qc.qubit
}
is unrolled to
%const = arith.constant 0.123 : f64
qc.ctrl(%c0) targets(%c1) {
qc.p(%const) %c1 : !qc.qubit
}
qc.ctrl(%c0, %c1) targets(%t0, %t1) {
qc.rxx(%const) %t0, %t1 : !qc.qubit, !qc.qubit
}
Notice that we already have such a canonicalization for one-operation ctrl modifiers. It should be possible to adapt some of the existing code.
Acceptance criteria
- The described canonicalization is implemented in QC and QCO
- The two comments made in #1603 are taken into account
Description
#1751 has dropped the condition that modifier bodies can only contain a single unitary operation followed by a
yieldoperation.We should add a canonicalization that pulls out
GPhaseOps from multi-operationctrlmodifiers. For example,is unrolled to
Notice that we already have such a canonicalization for one-operation
ctrlmodifiers. It should be possible to adapt some of the existing code.Acceptance criteria