Skip to content

nir/opt_loop: Don't peel header blocks that jump

This pass is run before nir_opt_dead_cf, so if-statements
following unconditional jumps aren't cleaned up yet.
This can cause "break"/"continue"-statements to be placed
outside the loop they're intended for. Peeling makes no
sense here, since nir_opt_dead_cf will clean up the loop
anyway.

This fixes a crash in Ghostwire: Tokyo with raytracing enabled because we ended up with a break outside of any loop. I feel really lucky I didn't encounter this bug with nested loops, where this would've silently miscompiled o_O

/cc @daniel-schuermann

Merge request reports