nir/opt_loop_unroll: Fix has_nested_loop handling
authorJason Ekstrand <jason@jlekstrand.net>
Mon, 30 Mar 2020 21:39:01 +0000 (16:39 -0500)
committerMarge Bot <eric+marge@anholt.net>
Mon, 30 Mar 2020 22:20:47 +0000 (22:20 +0000)
commitb113170559b25a14439264e9f6aa5c0a41045589
treea72a82559f25a82f71bab365cdb7e29164f3c3ad
parent92afe94d28b8e6cb016fdbb59e415ec7257f5512
nir/opt_loop_unroll: Fix has_nested_loop handling

In 87839680c0a48, a very subtle mistake was made with the CFG walking
recursion.  Instead of setting the local has_nested_loop variable when
process child loops, has_nested_loop_out was passed directly into the
process_loop_in_block call.  This broke nested loop detection heuristics
and caused loop unrolling to run massively out of control.  In
particular, it makes the following CTS test compile virtually forever:

dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.struct_mixed_types.uniform_buffer_block_geom

Fixes: 87839680c0 "nir: Fix breakage of foreach_list_typed_safe..."
Closes: #2710
Reviewed-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4380>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4380>
src/compiler/nir/nir_opt_loop_unroll.c