pan/bi: Update ins->link after scheduling

Otherwise foreach_instr and friends will be subtly wrong. None of our
current passes rely on this but it's a footgun.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10961>
This commit is contained in:
Alyssa Rosenzweig 2021-07-12 12:05:28 -04:00 committed by Marge Bot
parent 522020e6ea
commit 0515c6a3fb

View file

@ -1565,6 +1565,21 @@ bi_schedule_block(bi_context *ctx, bi_block *block)
last_clause->flow_control = BIFROST_FLOW_NBTB_UNCONDITIONAL;
}
/* Reorder instructions to match the new schedule. First remove
* existing instructions and then recreate the list */
bi_foreach_instr_in_block_safe(block, ins) {
list_del(&ins->link);
}
bi_foreach_clause_in_block(block, clause) {
for (unsigned i = 0; i < clause->tuple_count; ++i) {
bi_foreach_instr_in_tuple(&clause->tuples[i], ins) {
list_addtail(&ins->link, &block->base.instructions);
}
}
}
block->scheduled = true;
#ifndef NDEBUG