I don't recall why it's in there but it is seemingly load-bearing. I suspect the issue is that the execute op is inserted in the wrong place - the partition is a gather of ops within the block and picking the exact insertion location may not be possible (especially with clones) as-is.
Here's a minimal repro that fails with error: operand #2 does not dominate this use if sortBlockTopologically is commented out:
I don't recall why it's in there but it is seemingly load-bearing. I suspect the issue is that the execute op is inserted in the wrong place - the partition is a gather of ops within the block and picking the exact insertion location may not be possible (especially with clones) as-is.
Here's a minimal repro that fails with
error: operand #2 does not dominate this use
ifsortBlockTopologically
is commented out: