nir: Silence a warning at -Og
authorAdam Jackson <ajax@redhat.com>
Tue, 26 Jan 2021 18:18:29 +0000 (13:18 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 18 Feb 2021 20:59:43 +0000 (20:59 +0000)
commitfad353d7f8a1830f61d8715daff702af35c340f4
treeca7225b46e7efbe71454a0020e7d0e6e785fa440
parent03d3294e35befc2be6ed0ed66ed92fab991c166d
nir: Silence a warning at -Og

This throws a curious warning:

   In file included from ../src/compiler/nir/nir.h:32,
                    from ../src/compiler/nir/nir_opt_if.c:24:
   ../src/compiler/nir/nir_opt_if.c: In function ‘opt_if_loop_last_continue’:
   ../src/compiler/glsl/list.h:415:64: warning: ‘nif’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     415 |    return !exec_list_is_empty(list) ? list->tail_sentinel.prev : NULL;
         |                                                                ^

What's going on here is not enough of the optimizer has run to be able
to prove that nif is always initialized. So just handle the "can't
happen" case as if it could.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8724>
src/compiler/nir/nir_opt_if.c