nir: Fix breakage of foreach_list_typed_safe assumptions in loop unrolling
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Fri, 13 Mar 2020 14:06:07 +0000 (16:06 +0200)
committerDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Mon, 30 Mar 2020 11:41:30 +0000 (14:41 +0300)
commit87839680c0a48a007bce2aca9f056694ad8bd35d
treea07cdfea68b1757be6773867babcde0567e2b010
parent716a065ac05b2347054077aea389d3c877585b6f
nir: Fix breakage of foreach_list_typed_safe assumptions in loop unrolling

foreach_list_typed_safe works with assumption that even if current node
becomes invalid, the next will be still valid.

However process_loops broke this assumption, because during iteration
when immediate child is unrolled - not only current node could be removed
but also the one after it.

This doesn't cause issues now but it will cause issues when undefined
behaviour in foreach* macros is fixed.

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4189>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4189>
src/compiler/nir/nir_opt_loop_unroll.c