nir_to_tgsi: Fold comparisons
Right now if you have if a != 0 { ... }
in your shader, we'll get a TGSI SNE b, a, 0; IF b
sequence, instead of IF a
.
Fix:
- At
nir_if
emit time look at the SSA source of b and fold comparisons into the IF when possible. - Before ntt's RA, do a DCE pass on ALU instructions writing a dst that's never read.
Similar folding would also be useful for bcsel, fcsel and discard_if.