diff --git a/src/tint/writer/spirv/generator_impl_ir.cc b/src/tint/writer/spirv/generator_impl_ir.cc index 7ff56bec1d..202ccbe7ab 100644 --- a/src/tint/writer/spirv/generator_impl_ir.cc +++ b/src/tint/writer/spirv/generator_impl_ir.cc @@ -45,12 +45,20 @@ bool GeneratorImplIr::Generate() { // TODO(crbug.com/tint/1906): Emit variables. (void)zero_init_workgroup_memory_; + if (ir_->root_block) { + TINT_ICE(Writer, diagnostics_) << "root block is unimplemented"; + return false; + } // Emit functions. for (auto* func : ir_->functions) { EmitFunction(func); } + if (diagnostics_.contains_errors()) { + return false; + } + // Serialize the module into binary SPIR-V. writer_.WriteHeader(module_.IdBound()); writer_.WriteModule(&module_); @@ -231,6 +239,9 @@ void GeneratorImplIr::EmitBlock(const ir::Block* block) { block->branch.target, [&](const ir::FunctionTerminator*) { // TODO(jrprice): Handle the return value, which will be a branch argument. + if (!block->branch.args.IsEmpty()) { + TINT_ICE(Writer, diagnostics_) << "unimplemented return value"; + } current_function_.push_inst(spv::Op::OpReturn, {}); }, [&](Default) { TINT_ICE(Writer, diagnostics_) << "unimplemented branch target"; });