Skip to content

nir: Move if conditions to a separate instruction

Connor Abbott requested to merge cwabbott0/mesa:review/nir-if-instr into main

After I wrote a patch removing if_uses, Jason suggested we try this approach instead.

This was a bit trickier to get working than I expected, mainly because of all the special cases that had to be added from places that assumed anything after nir_jump was unreachable. However, we can remove many other special cases.

The first few changes are just refactoring various places that created if statements directly, so that they don't have to be updated to create a jump instruction. The second-to-last fixes a long-standing bug in the NIR control flow helpers that was exposed by this work. Then the last patch actually switches everything over.

I've checked that there are no shader-db differences for intel and radeonsi, but I haven't tested the other drivers yet. All the backend changes are relatively simple and mechanical, though.

Merge request reports