When we attach single-qubit gates to previous stages, we must make sure that they are still "single-qubit" in these stages. This PR fixes the bug of attaching gates that are single-qubit in this stage but multi-qubit in some previous stages because some global qubits are local in the previous stage.
When we attach single-qubit gates to previous stages, we must make sure that they are still "single-qubit" in these stages. This PR fixes the bug of attaching gates that are single-qubit in this stage but multi-qubit in some previous stages because some global qubits are local in the previous stage.