i965/nir: Handle returns as long as they're at the end of a function
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 25 Jun 2015 04:38:49 +0000 (21:38 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 25 Jun 2015 04:38:49 +0000 (21:38 -0700)
src/mesa/drivers/dri/i965/brw_fs_nir.cpp

index a378019af5b3c258751e2e7f4880e98c4a4311bf..46c30fcae26bedf66f48f0f4e72fd1ec81360109 100644 (file)
@@ -1774,6 +1774,12 @@ fs_visitor::nir_emit_jump(const fs_builder &bld, nir_jump_instr *instr)
       bld.emit(BRW_OPCODE_CONTINUE);
       break;
    case nir_jump_return:
+      /* 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");
    }