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>
This commit is contained in:
@@ -788,7 +788,7 @@ nir_block_ends_in_continue(nir_block *block)
|
||||
static bool
|
||||
opt_if_loop_last_continue(nir_loop *loop, bool aggressive_last_continue)
|
||||
{
|
||||
nir_if *nif;
|
||||
nir_if *nif = NULL;
|
||||
bool then_ends_in_continue = false;
|
||||
bool else_ends_in_continue = false;
|
||||
|
||||
@@ -824,7 +824,7 @@ opt_if_loop_last_continue(nir_loop *loop, bool aggressive_last_continue)
|
||||
}
|
||||
|
||||
/* If we didn't find an if to optimise return */
|
||||
if (!then_ends_in_continue && !else_ends_in_continue)
|
||||
if (!nif || (!then_ends_in_continue && !else_ends_in_continue))
|
||||
return false;
|
||||
|
||||
/* If there is nothing after the if-statement we bail */
|
||||
|
||||
Reference in New Issue
Block a user