spirv: Skip phis in unreachable blocks in the second phi pass
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 10 Jul 2020 21:09:27 +0000 (16:09 -0500)
committerMarge Bot <eric+marge@anholt.net>
Sun, 12 Jul 2020 00:02:45 +0000 (00:02 +0000)
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>

src/compiler/spirv/vtn_cfg.c

index 395a57756067d5d124d609552132fbc7d6b1d404..a31047b18b11174164aa06dfd6da35d4f69801b3 100644 (file)
@@ -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) {