nir: fix inserting the break instruction for partial loop unrolling
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 2 Nov 2023 09:40:00 +0000 (10:40 +0100)
committerEric Engestrom <eric@engestrom.ch>
Tue, 7 Nov 2023 13:28:05 +0000 (13:28 +0000)
commitcf3bd8bedc533a227eb66a0cc8cc507f57ae08ae
tree41c97bdd66e4be75c6f0dc17aba76fbb519b53f6
parent45368572c8fbb8003847947991f13d626c8a3c79
nir: fix inserting the break instruction for partial loop unrolling

If the break in the original loop isn't in the first top-level if,
this would have re-inserted it in the wrong block.

Fixes this by re-inserting the break block to the corresponding break
block in the new loop by using the remap hashtable.

fossils-db (NAVI21):
Totals from 88 (0.11% of 79330) affected shaders:
Instrs: 109602 -> 109929 (+0.30%); split: -0.10%, +0.40%
CodeSize: 570968 -> 573332 (+0.41%); split: -0.08%, +0.49%
Latency: 1682510 -> 1682505 (-0.00%); split: -0.01%, +0.01%
Copies: 12832 -> 12746 (-0.67%); split: -1.54%, +0.87%
Branches: 2879 -> 2930 (+1.77%)

Deathloop and F1 2023 are affected but I'm not aware of any issues
for these two games.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10001
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26009>
(cherry picked from commit abfd208cb047b24802938576d0f5bd1a7f809eb6)
.pick_status.json
src/compiler/nir/nir_opt_loop_unroll.c