i965/vec4: Handle returns at the end of functions
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 22 Oct 2015 03:42:23 +0000 (20:42 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 22 Oct 2015 03:42:23 +0000 (20:42 -0700)
src/mesa/drivers/dri/i965/brw_vec4_nir.cpp

index ea1e3e7bbcfb84bddc201b54e00722962f4248cf..e79a9f3b5b9129494c2840045dd7ae64d235a58c 100644 (file)
@@ -1521,7 +1521,13 @@ vec4_visitor::nir_emit_jump(nir_jump_instr *instr)
       break;
 
    case nir_jump_return:
-      /* fall through */
+      /* This has to be the last block in the shader.  We don't handle
+       * early returns.
+       */
+      assert(nir_cf_node_next(&instr->instr.block->cf_node) == NULL &&
+             instr->instr.block->cf_node.parent->type == nir_cf_node_function);
+      break;
+
    default:
       unreachable("unknown jump");
    }