From 1ef04f56c110e20363bac80935172e35a101c2e5 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 23 Oct 2020 12:26:03 -0500 Subject: [PATCH] spirv: Delete the impl for prototype-only functions Previously, when we had a prototype-only function in SPIR-V, we would compile it just fine and the function would have an impl that did nothing. This commit changes that so that the nir_function::impl is NULL to indicate a prototype-only function. Reviewed-by: Jesse Natalie Part-of: --- src/compiler/spirv/vtn_cfg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index 0e3454ab44a..8d0794ed4af 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -220,6 +220,12 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode, case SpvOpFunctionEnd: b->func->end = w; + if (b->func->start_block == NULL) { + /* In this case, the function didn't have any actual blocks. It's + * just a prototype so delete the function_impl. + */ + b->func->nir_func->impl = NULL; + } b->func = NULL; break;