This pass should be written when the IR is in explicit linear use form (aka, value semantics), as it will be much simpler to understand, write, etc.
It actually becomes trivial. A measurement op must produce 1 or more wires. If those wires are used by anything that is not a sink operation, they are reused. In those case, if the reuse is not a reset operation, then insert a reset operation. Done.
Originally posted by @schweitzpgi in #3450 (review)
Note: the value semantics indeed simplifies the use tracking of qubit wire after measure. There are still some considerations around qubit wire aliasing, i.e., multiple linear wires could be referring to the same physical qubit extracted from a qubit register at a specific index.