From 581c99b30c5b108ae72ebeedfddbd3d789e401cf Mon Sep 17 00:00:00 2001 From: Karmjit Mahil Date: Thu, 26 Sep 2024 11:01:21 +0200 Subject: [PATCH] ir3: Use `foreach_instr_safe` in ir3_shared_folding When processing the last instruction prior to the block terminator, ir3_shader_folding can append a new instruction prior to the terminator, so the `current_instruction->next == new_instruciton` instead of `current_instruction->next == terminator` which leads to the assert in `foreach_instr` being hit, so use `foreach_instr_safe`. Signed-off-by: Karmjit Mahil Part-of: --- src/freedreno/ir3/ir3_shared_folding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/freedreno/ir3/ir3_shared_folding.c b/src/freedreno/ir3/ir3_shared_folding.c index 69ab964b16d..5443880d12e 100644 --- a/src/freedreno/ir3/ir3_shared_folding.c +++ b/src/freedreno/ir3/ir3_shared_folding.c @@ -120,7 +120,7 @@ ir3_shared_fold(struct ir3 *ir) * reverse to try and convert an entire phi-web in one go. */ foreach_block_rev (block, &ir->block_list) { - foreach_instr (instr, &block->instr_list) { + foreach_instr_safe (instr, &block->instr_list) { progress |= try_shared_folding(instr, mem_ctx); } }