summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2020-07-10 16:09:27 -0500
committerEric Engestrom <eric@engestrom.ch>2020-07-22 22:30:04 +0200
commit32d2431a553945ccf44edb419a003c1070eb4694 (patch)
tree36f44a9f4d93cf037cb549079e2aa58235f34852 /src
parentd5fcf18614146c13e1661bc2d0e1e609ab40c2ed (diff)
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@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5855> (cherry picked from commit 81773b4b441fbd8ec284de78e4dfdcecdca112dc)
Diffstat (limited to 'src')
-rw-r--r--src/compiler/spirv/vtn_cfg.c9
1 files changed, 8 insertions, 1 deletions
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) {