nir/sink: Rewrite loop handling & enable with ACO
This is an alternative to !1664 (closed) that I wrote as I was reviewing it. I think that they should be equivalent, but this approach seems simpler and easier to verify for me. It's also closer to how nir_opt_gcm
works, which is where I got the inspiration from.