Giovanni pointed out off-list that the new version now leaks instructions on error paths.
In order to resolve that I've shuffled things around in my local branch—4/5 is removed from this series (I'll send it separately later) and 5/5 is combined with a later patch I had that introduces a lower_ir() helper, which takes care of a bit more of the hlsl_block boilerplate. This lower_ir() helper ends up being useful for pretty much every lowering pass, of which we have quite a lot.