diff --git a/src/amd/compiler/aco_interface.cpp b/src/amd/compiler/aco_interface.cpp index 08274ea2bc3..4eefd188edd 100644 --- a/src/amd/compiler/aco_interface.cpp +++ b/src/amd/compiler/aco_interface.cpp @@ -84,25 +84,25 @@ get_disasm_string(aco::Program* program, std::vector& code, unsigned e { std::string disasm; - if (check_print_asm_support(program)) { - char* data = NULL; - size_t disasm_size = 0; - struct u_memstream mem; - if (u_memstream_open(&mem, &data, &disasm_size)) { - FILE* const memf = u_memstream_get(&mem); + char* data = NULL; + size_t disasm_size = 0; + struct u_memstream mem; + if (u_memstream_open(&mem, &data, &disasm_size)) { + FILE* const memf = u_memstream_get(&mem); + if (check_print_asm_support(program)) { aco::print_asm(program, code, exec_size / 4u, memf); - fputc(0, memf); - u_memstream_close(&mem); + } else { + fprintf(memf, "Shader disassembly is not supported in the current configuration" +#ifndef LLVM_AVAILABLE + " (LLVM not available)" +#endif + ", falling back to print_program.\n\n"); + aco::aco_print_program(program, memf); } - + fputc(0, memf); + u_memstream_close(&mem); disasm = std::string(data, data + disasm_size); free(data); - } else { - disasm = "Shader disassembly is not supported in the current configuration" -#ifndef LLVM_AVAILABLE - " (LLVM not available)" -#endif - ".\n"; } return disasm;