Mesa (main): broadcom/compiler: fix assert that current instruction must be in current block
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 22 05:58:19 UTC 2021
Module: Mesa
Branch: main
Commit: 1561d0126a569f76b1adbdd1a5e8ec79f9577450
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1561d0126a569f76b1adbdd1a5e8ec79f9577450
Author: Iago Toral Quiroga <itoral at igalia.com>
Date: Thu Oct 21 11:35:28 2021 +0200
broadcom/compiler: fix assert that current instruction must be in current block
This was not considering the possibility that the driver has called
nir_before_block() or nir_after_block() to update the cursor, in which
case the cursor link points to the instruction list header and not
to an actual instruction.
Fixes incorrect debug-assert crash in:
dEQP-VK.graphicsfuzz.cov-increment-vector-component-with-matrix-copy
Fixes: 265515fa62 ("broadcom/compiler: check instruction belongs to current block")
Reviewed-by: Juan A. Suarez <jasuarez at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13467>
---
src/broadcom/compiler/vir.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 27869a35a3b..bf75a4da170 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -1873,7 +1873,10 @@ try_opt_ldunif(struct v3d_compile *c, uint32_t index, struct qreg *unif)
assert(c->cur_block);
#ifdef DEBUG
- /* Check if the current instruction is part of the current block */
+ /* We can only reuse a uniform if it was emitted in the same block,
+ * so callers must make sure the current instruction is being emitted
+ * in the current block.
+ */
bool found = false;
vir_for_each_inst(inst, c->cur_block) {
if (&inst->link == c->cursor.link) {
@@ -1882,7 +1885,7 @@ try_opt_ldunif(struct v3d_compile *c, uint32_t index, struct qreg *unif)
}
}
- assert(found || list_is_empty(&c->cur_block->instructions));
+ assert(found || &c->cur_block->instructions == c->cursor.link);
#endif
list_for_each_entry_from_rev(struct qinst, inst, c->cursor.link->prev,
More information about the mesa-commit
mailing list