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 <karmjit.mahil@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31478>
This commit is contained in:
Karmjit Mahil 2024-09-26 11:01:21 +02:00 committed by Marge Bot
parent 5ba00df1f9
commit 581c99b30c

View file

@ -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);
}
}