From ae032e5ea61dac3c63d74056174939e5ec091629 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 5 Oct 2016 19:56:54 -0700 Subject: [PATCH] nir: Remove some no longer needed asserts Now that the NIR casting functions have type assertions, we have a bunch of assertions that aren't needed anymore. Signed-off-by: Jason Ekstrand Reviewed-by: Connor Abbott --- src/compiler/nir/nir.h | 1 - src/compiler/nir/nir_control_flow.c | 6 ------ src/compiler/nir/nir_lower_atomics.c | 1 - src/compiler/nir/nir_lower_indirect_derefs.c | 2 -- src/compiler/nir/nir_lower_io.c | 1 - src/compiler/nir/nir_lower_locals_to_regs.c | 1 - src/compiler/nir/nir_lower_to_source_mods.c | 4 +--- src/compiler/nir/nir_opt_peephole_select.c | 1 - 8 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 8a9ccf28971..d6c8eface00 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2147,7 +2147,6 @@ nir_after_cf_node_and_phis(nir_cf_node *node) return nir_after_block(nir_cf_node_as_block(node)); nir_block *block = nir_cf_node_as_block(nir_cf_node_next(node)); - assert(block->cf_node.type == nir_cf_node_block); return nir_after_phis(block); } diff --git a/src/compiler/nir/nir_control_flow.c b/src/compiler/nir/nir_control_flow.c index 380e8aa07c9..d33819d56da 100644 --- a/src/compiler/nir/nir_control_flow.c +++ b/src/compiler/nir/nir_control_flow.c @@ -154,8 +154,6 @@ link_block_to_non_block(nir_block *block, nir_cf_node *node) * any predecessors that need to be unlinked. */ - assert(node->type == nir_cf_node_loop); - nir_loop *loop = nir_cf_node_as_loop(node); nir_block *loop_header_block = nir_loop_first_block(loop); @@ -300,7 +298,6 @@ block_add_normal_succs(nir_block *block) nir_cf_node *parent = block->cf_node.parent; if (parent->type == nir_cf_node_if) { nir_cf_node *next = nir_cf_node_next(parent); - assert(next->type == nir_cf_node_block); nir_block *next_block = nir_cf_node_as_block(next); link_blocks(block, next_block, NULL); @@ -312,7 +309,6 @@ block_add_normal_succs(nir_block *block) link_blocks(block, head_block, NULL); insert_phi_undef(head_block, block); } else { - assert(parent->type == nir_cf_node_function); nir_function_impl *impl = nir_cf_node_as_function(parent); link_blocks(block, impl->end_block, NULL); } @@ -326,7 +322,6 @@ block_add_normal_succs(nir_block *block) link_blocks(block, first_then_block, first_else_block); } else { - assert(next->type == nir_cf_node_loop); nir_loop *next_loop = nir_cf_node_as_loop(next); nir_block *first_block = nir_loop_first_block(next_loop); @@ -473,7 +468,6 @@ nir_handle_add_jump(nir_block *block) link_blocks(block, first_block, NULL); } else { nir_cf_node *after = nir_cf_node_next(&loop->cf_node); - assert(after->type == nir_cf_node_block); nir_block *after_block = nir_cf_node_as_block(after); link_blocks(block, after_block, NULL); } diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/nir/nir_lower_atomics.c index 583e2a50c74..6fea8f468f2 100644 --- a/src/compiler/nir/nir_lower_atomics.c +++ b/src/compiler/nir/nir_lower_atomics.c @@ -112,7 +112,6 @@ lower_instr(nir_intrinsic_instr *instr, nir_deref *tail = &instr->variables[0]->deref; while (tail->child != NULL) { - assert(tail->child->deref_type == nir_deref_type_array); nir_deref_array *deref_array = nir_deref_as_array(tail->child); tail = tail->child; diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c index 9c5349a772d..356373e2788 100644 --- a/src/compiler/nir/nir_lower_indirect_derefs.c +++ b/src/compiler/nir/nir_lower_indirect_derefs.c @@ -35,8 +35,6 @@ emit_indirect_load_store(nir_builder *b, nir_intrinsic_instr *orig_instr, int start, int end, nir_ssa_def **dest, nir_ssa_def *src) { - assert(arr_parent->child && - arr_parent->child->deref_type == nir_deref_type_array); nir_deref_array *arr = nir_deref_as_array(arr_parent->child); assert(arr->deref_array_type == nir_deref_array_type_indirect); assert(arr->indirect.is_ssa); diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index a3b14238993..d77cb134533 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -143,7 +143,6 @@ get_io_offset(nir_builder *b, nir_deref_var *deref, */ if (vertex_index != NULL) { tail = tail->child; - assert(tail->deref_type == nir_deref_type_array); nir_deref_array *deref_array = nir_deref_as_array(tail); nir_ssa_def *vtx = nir_imm_int(b, deref_array->base_offset); diff --git a/src/compiler/nir/nir_lower_locals_to_regs.c b/src/compiler/nir/nir_lower_locals_to_regs.c index 61cc7fa1989..cddd9fa9b53 100644 --- a/src/compiler/nir/nir_lower_locals_to_regs.c +++ b/src/compiler/nir/nir_lower_locals_to_regs.c @@ -282,7 +282,6 @@ compute_reg_usedef_lca(nir_register *reg) list_for_each_entry(nir_src, use_src, ®->if_uses, use_link) { nir_cf_node *prev_node = nir_cf_node_prev(&use_src->parent_if->cf_node); - assert(prev_node->type == nir_cf_node_block); lca = nir_dominance_lca(lca, nir_cf_node_as_block(prev_node)); } diff --git a/src/compiler/nir/nir_lower_to_source_mods.c b/src/compiler/nir/nir_lower_to_source_mods.c index 7a1507ced5f..69502d9b54c 100644 --- a/src/compiler/nir/nir_lower_to_source_mods.c +++ b/src/compiler/nir/nir_lower_to_source_mods.c @@ -164,9 +164,7 @@ nir_lower_to_source_mods_block(nir_block *block) nir_foreach_use(child_src, &alu->dest.dest.ssa) { assert(child_src->is_ssa); - nir_instr *child = child_src->parent_instr; - assert(child->type == nir_instr_type_alu); - nir_alu_instr *child_alu = nir_instr_as_alu(child); + nir_alu_instr *child_alu = nir_instr_as_alu(child_src->parent_instr); child_alu->op = nir_op_fmov; child_alu->dest.saturate = false; diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c index 29543d6be7a..9c85c178ac7 100644 --- a/src/compiler/nir/nir_opt_peephole_select.c +++ b/src/compiler/nir/nir_opt_peephole_select.c @@ -181,7 +181,6 @@ nir_opt_peephole_select_block(nir_block *block, void *mem_ctx, unsigned limit) */ nir_block *prev_block = nir_cf_node_as_block(nir_cf_node_prev(prev_node)); - assert(prev_block->cf_node.type == nir_cf_node_block); /* First, we move the remaining instructions from the blocks to the * block before. We have already guaranteed that this is safe by -- 2.30.2