Open
Description
Currently cancel_inverses
does not detect potential opportunities if they are separated across the boundary of control flow constructs, e.g. for(4){Hadamard}
or Hadamard, if(cond){True: Identity, False: Hadamard}
. Being able to detect these opportunities would be a good addition.
This issue is more general than cancel_inverses
. We essentially want to have an analysis available without having to explicitly unroll loops or hoist conditionals, since these could be expensive and are not guaranteed to happen.