diff --git a/.pick_status.json b/.pick_status.json index debfb077158..bc90d6c0c84 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -43504,7 +43504,7 @@ "description": "compiler/spirv: vtn_add_printf_string support for handling OpBitcast", "nominated": false, "nomination_type": 3, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/compiler/spirv/vtn_opencl.c b/src/compiler/spirv/vtn_opencl.c index 59ec75da885..5785057da1d 100644 --- a/src/compiler/spirv/vtn_opencl.c +++ b/src/compiler/spirv/vtn_opencl.c @@ -743,8 +743,15 @@ vtn_add_printf_string(struct vtn_builder *b, uint32_t id, u_printf_info *info) { nir_deref_instr *deref = vtn_nir_deref(b, id); - while (deref && deref->deref_type != nir_deref_type_var) - deref = nir_deref_instr_parent(deref); + while (deref->deref_type != nir_deref_type_var) { + nir_scalar parent = nir_scalar_resolved(deref->parent.ssa, 0); + if (parent.def->parent_instr->type != nir_instr_type_deref) { + deref = NULL; + break; + } + vtn_assert(parent.comp == 0); + deref = nir_instr_as_deref(parent.def->parent_instr); + } vtn_fail_if(deref == NULL || !nir_deref_mode_is(deref, nir_var_mem_constant), "Printf string argument must be a pointer to a constant variable");