brw/print: Don't let SHADER_OPCODE_FLOW affect indentation

In `fossilize-replay --pipeline-hash 375a63e14afa96c4
fossils/fossil-db/steam-dxvk/f1_22_abu_dhabi.dx12vk-ultra.foz`,
`cf_count` would get decremented below zero. This would lead trying to
print `UINT_MAX` levels of indentation just a few lines below. I ran
out of disk space and patience before that finished. 🤣

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33748>
This commit is contained in:
Ian Romanick 2025-02-25 16:51:22 -08:00 committed by Marge Bot
parent bef1c23a23
commit 495812d8e0

View file

@ -30,8 +30,14 @@ brw_print_instructions(const brw_shader &s, FILE *file)
fprintf(file, "\n");
foreach_inst_in_block(brw_inst, inst, block) {
if (inst->is_control_flow_end())
/* SHADER_OPCODE_FLOW ends a block, but it does not change the
* control flow nested (i.e., the indentation).
*/
if (inst->is_control_flow_end() && inst->opcode != SHADER_OPCODE_FLOW) {
/* If cf_count is 0 and decremented, bad things will happen. */
assert(cf_count > 0);
cf_count -= 1;
}
if (rp) {
max_pressure = MAX2(max_pressure, rp->regs_live_at_ip[ip]);