nir: Remove some no longer needed asserts
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 6 Oct 2016 02:56:54 +0000 (19:56 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 6 Oct 2016 16:16:39 +0000 (09:16 -0700)
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 <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/compiler/nir/nir.h
src/compiler/nir/nir_control_flow.c
src/compiler/nir/nir_lower_atomics.c
src/compiler/nir/nir_lower_indirect_derefs.c
src/compiler/nir/nir_lower_io.c
src/compiler/nir/nir_lower_locals_to_regs.c
src/compiler/nir/nir_lower_to_source_mods.c
src/compiler/nir/nir_opt_peephole_select.c

index 8a9ccf2..d6c8efa 100644 (file)
@@ -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);
 }
index 380e8aa..d33819d 100644 (file)
@@ -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);
       }
index 583e2a5..6fea8f4 100644 (file)
@@ -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;
 
index 9c5349a..356373e 100644 (file)
@@ -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);
index a3b1423..d77cb13 100644 (file)
@@ -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);
index 61cc7fa..cddd9fa 100644 (file)
@@ -282,7 +282,6 @@ compute_reg_usedef_lca(nir_register *reg)
 
    list_for_each_entry(nir_src, use_src, &reg->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));
    }
 
index 7a1507c..69502d9 100644 (file)
@@ -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;
index 29543d6..9c85c17 100644 (file)
@@ -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