Mesa (staging/20.1): spirv: Skip phis in unreachable blocks in the second phi pass
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 13 22:00:00 UTC 2020
Module: Mesa
Branch: staging/20.1
Commit: 8f9e4f9f62697be038dd98402626c4f457fd0316
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f9e4f9f62697be038dd98402626c4f457fd0316
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Fri Jul 10 16:09:27 2020 -0500
spirv: Skip phis in unreachable blocks in the second phi pass
Closes: #3253
Fixes: 22fdb2f8551 "nir/spirv: Update to the latest revision"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5855>
(cherry picked from commit 81773b4b441fbd8ec284de78e4dfdcecdca112dc)
---
.pick_status.json | 2 +-
src/compiler/spirv/vtn_cfg.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 562d84ddf53..023b4a11808 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -625,7 +625,7 @@
"description": "spirv: Skip phis in unreachable blocks in the second phi pass",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "22fdb2f8551330fea308ce9cfe151ec00201e2b1"
},
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 395a5775606..a31047b18b1 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -1003,7 +1003,14 @@ vtn_handle_phi_second_pass(struct vtn_builder *b, SpvOp opcode,
return true;
struct hash_entry *phi_entry = _mesa_hash_table_search(b->phi_table, w);
- vtn_assert(phi_entry);
+
+ /* It's possible that this phi is in an unreachable block in which case it
+ * may never have been emitted and therefore may not be in the hash table.
+ * In this case, there's no var for it and it's safe to just bail.
+ */
+ if (phi_entry == NULL)
+ return true;
+
nir_variable *phi_var = phi_entry->data;
for (unsigned i = 3; i < count; i += 2) {
More information about the mesa-commit
mailing list