diff options
author | Jason Ekstrand <[email protected]> | 2020-06-10 12:47:50 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-07-06 19:54:30 +0000 |
commit | be96b069ad4e41f9d440d04b5dbbffe599774473 (patch) | |
tree | 7d4214ef9810aa80793d08e5c054c141aee4e903 /src/compiler | |
parent | b019b22c7aed8141a5f279619c239fd2a4eda843 (diff) |
nir: Assert that nir_lower_io is only called with allowed modes
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5418>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_lower_io.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 6a0e1814413..101460afa97 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -626,16 +626,10 @@ nir_lower_io_block(nir_block *block, nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]); nir_variable_mode mode = deref->mode; - + assert(util_is_power_of_two_nonzero(mode)); if ((state->modes & mode) == 0) continue; - if (mode != nir_var_shader_in && - mode != nir_var_shader_out && - mode != nir_var_mem_shared && - mode != nir_var_uniform) - continue; - nir_variable *var = nir_deref_instr_get_variable(deref); b->cursor = nir_before_instr(instr); @@ -723,6 +717,11 @@ nir_lower_io_impl(nir_function_impl *impl, state.type_size = type_size; state.options = options; + ASSERTED nir_variable_mode supported_modes = + nir_var_shader_in | nir_var_shader_out | + nir_var_mem_shared | nir_var_uniform; + assert(!(modes & ~supported_modes)); + nir_foreach_block(block, impl) { progress |= nir_lower_io_block(block, &state); } |