Instead of returning an ArrayRef<Operation *>, return at iterator that skips ops that were erased/replaced while iterating over the payload ops.
This fixes an issue in conjuction with TrackingListener, where a tracked op was erased during the iteration. Elements may not be removed from an array while iterating over it; this invalidates the iterator.
When ops are erased/removed via replacePayloadOp, they are not immediately removed from the mappings data structure. Instead, they are set to nullptr. nullptrs are not enumerated by getPayloadOps. At the end of each transformation, nullptrs are removed from the mapping data structure.
Depends On: D149937
Nit: please document.