lima/gpir: Optimize conditional break/continue
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 3 Oct 2019 19:24:02 +0000 (15:24 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 16 Mar 2020 23:08:06 +0000 (23:08 +0000)
commit47dacf3867194fd456f015bc2a54d2ee4af30f4c
treecfc06019441b5754cdd2f95f2f502a415585eb93
parent9fb0fda8e7bfa95686fd60ee563938b8e1196437
lima/gpir: Optimize conditional break/continue

Optimize the result of a conditional break/continue. In NIR something
like:

loop {
   ...
   if (cond)
      continue;

would get lowered to:

block_0:
...
block_1:
branch_cond !cond block_3
block_2:
branch_uncond block_0
block_3:
...

We recognize the conditional branch skipping over the unconditional
branch, and turn it into:

block_0:
...
block_1:
branch_cond cond block_0
block_2:
block_3:

Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4125>
src/gallium/drivers/lima/ir/gp/gpir.h
src/gallium/drivers/lima/ir/gp/nir.c
src/gallium/drivers/lima/ir/gp/optimize.c [new file with mode: 0644]
src/gallium/drivers/lima/meson.build