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 8a9ccf28971b91c0152a8a812401e9289535367b..d6c8eface00caca02d4f7518777a243ef707ee9b 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 380e8aa07c958a9bafe812c1b1369918d87d689a..d33819d56da551e6d4e6081cca7682247b0228db 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 583e2a50c742081404b0115a5a13bc8f46ec71d5..6fea8f468f2c99b0663ed2f7badd3fb1cd3a351c 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 9c5349a772d919115e0f830dcebe0bd92c228da9..356373e2788d33d37529f117cfead752bf2fe340 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 a3b14238993c91a2480349909b0a846f40b9baf3..d77cb134533ee9ecf5f066fb5123081622f38e15 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 61cc7fa19891a6af490dd11bf86c1645c165babd..cddd9fa9b53ef075df3e6585929af46f083dddbc 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 7a1507ced5f9774a36045e7f11f5539774ad8a6b..69502d9b54c04b6850fd6be9f435b5ec152a556f 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 29543d6be7a184b73bf1c1bc9236a15d0d15a422..9c85c178ac74d199a927d25f817f4234d65100fc 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