diff --git a/src/amd/compiler/tests/helpers.cpp b/src/amd/compiler/tests/helpers.cpp index ed15e35eb75..58303346a8d 100644 --- a/src/amd/compiler/tests/helpers.cpp +++ b/src/amd/compiler/tests/helpers.cpp @@ -386,28 +386,31 @@ void print_pipeline_ir(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBi result = GetPipelineExecutableInternalRepresentationsKHR(device, &exec_info, &ir_count, ir); assert(result == VK_SUCCESS); - for (unsigned i = 0; i < ir_count; i++) { - if (strcmp(ir[i].name, name)) - continue; + VkPipelineExecutableInternalRepresentationKHR* requested_ir = nullptr; + for (unsigned i = 0; i < ir_count; ++i) { + if (strcmp(ir[i].name, name) == 0) { + requested_ir = &ir[i]; + break; + } + } + assert(requested_ir && "Could not find requested IR"); - char *data = (char*)malloc(ir[i].dataSize); - ir[i].pData = data; - result = GetPipelineExecutableInternalRepresentationsKHR(device, &exec_info, &ir_count, ir); - assert(result == VK_SUCCESS); + char *data = (char*)malloc(requested_ir->dataSize); + requested_ir->pData = data; + result = GetPipelineExecutableInternalRepresentationsKHR(device, &exec_info, &ir_count, ir); + assert(result == VK_SUCCESS); - if (remove_encoding) { - for (char *c = data; *c; c++) { - if (*c == ';') { - for (; *c && *c != '\n'; c++) - *c = ' '; - } + if (remove_encoding) { + for (char *c = data; *c; c++) { + if (*c == ';') { + for (; *c && *c != '\n'; c++) + *c = ' '; } } - - fprintf(output, "%s", data); - free(data); - return; } + + fprintf(output, "%s", data); + free(data); } VkShaderModule __qoCreateShaderModule(VkDevice dev, const QoShaderModuleCreateInfo *module_info)