nir/lower_io: don't reduce range if parent length is zero
authorAlejandro Piñeiro <apinheiro@igalia.com>
Tue, 15 Sep 2020 21:53:14 +0000 (23:53 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 16 Sep 2020 21:24:28 +0000 (23:24 +0200)
commit2aaa1564ad0620724eaf38d66cec85dafad4613e
tree46e31b62665593691ecab42b4c5d347a7c96e413
parenta51aa6feb4dab07e29b9834f7ad431cc0dd6f9fe
nir/lower_io: don't reduce range if parent length is zero

When handling arrays, range is increased based on the array size minus
one. But if such is zero, it has the effect of reducing the
range. Handle that case by returning the unknown range value.

v2:
  * Add missing braces.
  * Return unknown range in this case, instead of keeping the initial
    range.
v3: Simplify code, using existing "fail" label. (Jason)

Fixes the following using v3dv:
  dEQP-VK.graphicsfuzz.cov-simplify-clamp-max-itself

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6737>
src/compiler/nir/nir_lower_io.c